Assignment of Python Programming
Assignment Of Communicative English
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?
Q2. Describe function with example and define recursive function also.
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
Comments