yt

Header Ads

Assignment of Python Programming/How to Create Assignment of python

Assignment of Python Programming 

Assignment Of Communicative English

 **Assignment Of ITA**

**Assignment Of  PMO**

**Assignment Of  MATH**



Agenda: - 4 Questions discuss in this post.


Q1. Describe data Type available in python?

Q2. Describe function with example and define recursive function also.

Q3. Describe all the features of python Highlight all those features with are new in python. with respect to other language.

QA. High level language

QB. Dynamically typed

QC. Platform indecent

Q4. What are modules in python  satisfy with proper Example.




Q1. Describe data Type available in python?

Ans:- 
Data types :-  A data type represent the type of data stored into a variable or memory .In programming, data type is an important concept variables can store data of different types, and different types can do different things.
There are two types of data:- Built-in Data Types and user defined data types.


Python has the following data types built-in by default, in these categories:

1. Text Type:-
A. string :- Strings in python are surrounded by either single quotation marks, or double quotation marks
'hello' is the same as "hello".
You can display a string literal with the print() function:

Example
print("Sls j")
print('Sls J')

2. Numeric Types:- There are three numeric types in Python:- int, float, complex

A. Integer, or int:- It is a whole number, positive or negative, without decimals, of unlimited length it called integer value.
Examples of integer :-
x = 1
y = 35656222554887711
z = -3255522

print(type(x))
print(type(y))
print(type(z))

B. Float, or "floating :- It is point number" is a number, positive or negative, containing one or more decimals.
Example:-
x = 35e3
y = 12E4
z = -87.7e100

print(type(x))
print(type(y))
print(type(z))

C. Complex:- It's numbers are written with a "j" as the imaginary part:
Example
x = 4+5j
y = 3j
z = -5j

print(type(x))
print(type(y))
print(type(z))

4.Sequence Types: list, tuple, range
5.Mapping Type: dictionary (dict)
6.Set Types: set, frozenset
7.Boolean Type:-Booleans represent one of two values: True or False.
Binary Types: bytes, bytearray, memoryview

So , well you can say that these types of data type in python programming.


Q2. Describe function with example and define recursive function also.

Ans :- 
Python Function:- A function is a set of code and reusable code, that is used to perform a single and reputed function so it is called function. 

Feature of Python :-  Python allows us to divide a large program into the basic building blocks known as a function. The function contains the set of programming statements enclosed by {}. A function can be called multiple times to provide reusability and modularity to the Python program.


There are two types in python function:-

1. User-define functions :- The user-defined functions are those define by the user to perform the specific task. It means all programmer of our choice so we can called it user defined function 

Example 1. User defined function 

def sum():  

    s= 10  

    j = 20  

    sj = a+b  

    return sj  

print("The sum is:" ,sum())

Output :- The sum is: 30


2.Built-in functions:-The built-in functions are those functions that are pre-defined in Python.  It means int, str, float etc. are data types is built in function.


Recursive function:- When a function call itself it called recursive function. It is used to accomplished many task easily and intuitively.

Let me > 1,1,2,3,5,8,13...............

here now that each term is the Sum of the pervious two terms, the 1st and 2nd terms being 1 and 1 respectively. This series is called Fibonacci series.

Example 1.  Find a factorial of any number using recursive function.

Solution :-

def fact (n):

    fi n ==1:

            return 1:

     else:

               return n*fact (n*1)

num =int(input("Enter your number :-"))

res =fact (num)

print ("The factorial of ", num,"is ",res)

Output:- 

            Enter your number :-5

            The factorial of 5 is 120


Q3. Describe all the features of python Highlight all those features with are new in python. with respect to other language.

A. High level language

B. Dynamically typed

C. Platform indecent

Ans :- 

Python:- Python is a simple, general purpose, high level, and object-oriented programming language.

Python is an interpreted scripting language also. Guido Van Rossum is known as the founder of Python programming.

python has wide range of libraries and frameworks widely used in various fields such as machine learning, artificial intelligence, web applications, etc. We define some popular frameworks and libraries of Python as follows.

  • Web development (Server-side) - Django Flask, Pyramid, CherryPy
  • GUIs based applications - Tk, PyGTK, PyQt, PyJs, etc.
  • Machine Learning - TensorFlow, PyTorch, Scikit-learn, Matplotlib, Scipy, etc.
  • Mathematics - Numpy, Pandas, etc.


A. High level language:- Python is easy to learn yet powerful and versatile scripting language, which makes it attractive for Application Development. So this compiler are very in advanced then compiler high level languge to low level languge it called high leve'

B. Dynamically typed:- Python's syntax and dynamic typing with its interpreted nature make it an ideal language for scripting and rapid application development.

Python supports multiple programming pattern, including object-oriented, imperative, and functional or procedural programming styles.

Python is not intended to work in a particular area, such as web programming. That is why it is known as multipurpose programming language because it can be used with web, enterprise, 3D CAD, etc.

We don't need to use data types to declare variable because it is dynamically typed so we can write a=10 to assign an integer value in an integer variable.

Python makes the development and debugging fast because there is no compilation step included in Python development, and edit-test-debug cycle is very fast.


Q4. What are modules in python satisfy with proper Example.

Ans :-

Module :-It is a collection of function in a order type of python called a modules it called another language like java called it' pakage".

Feature of Module in python :-

>Module means called it managing tool in python in sequence ways of python in function program it is stored function variable and constant so be can say that at last it is programing structure not based on coding rather to arrange programming elements like function.

>For example:-A file contains in python code for example:- sudhir.py is called a module and here, its module name be sudhir 

>we can use always module to break down on large program into small manageable and organized files.


Example of module program

Well before an example discus  keyword of module  "import" then this import' keyword used three types like that.

(a) import my module

(b) from my module import

(c) import module as {file.name}.   

Here now discussed an example of module:-

Example 1:-

from mymodule import add    

f num =int(input("enter 1st number"))

s num =int(input("enter 1st number")) 

print("the sum of",fnum ,"and", snum,"is:-", add (fnum, snum))

 output :-    enter 1st number :- 10   

                   enter 2nd number :- 20   

                   the sum of number :- 30 

Example 2.

from calculation import summation    

a = int(input("Enter the first number"))  

b = int(input("Enter the second number"))  

print("Sum = ",summation(a,b)) 


Thanks for watching , I hope this post is helpful for your 


 

   

 

No comments

Theme images by Dizzo. Powered by Blogger.