python
python
GURUGRAM
PRACTICAL FILE
OF
PYTHON
1
INDEX
Sr.
PROGRAMS PAGE NO. Date Sign
NO
2
Write a python program to print prim
11. 14
numbers less than 20
3
1. Write a program to demonstrate different number datatypes in python.
Source code:
Output:
4
2. Write a program to perform different arithmetic operations on
numbers in python.
Source code:
Output:
5
3. Write a program to create, concatenate and print a
string and accessing sub-string from a given string.
Source code:
Output:
6
4. Write a python script to print the current date in following
format “Sun May 29 02:26:23 IST 2017”
Source code:
Output:
7
5. Write a python program to create, append and remove lists in
Output:
8
6. Write a program to demonstrate working with tuples in python
Output:
9
7. Write a program to demonstrate working with dictionaries in python
Source code:
Output:
10
8. Write a python program to find largest of three numbers
Source code:
Output:
11
9. Write a python program to convert temperature to and from
Celsius to Fahrenheit.
Source code:
Output:
12
10. Write a python program to construct the following pattern using
nested for loop:
*
**
***
****
*****
*****
****
***
**
*
Source code:
Output:
13
11. Write a python program to print prim numbers less
Output:
14
12. Write a python program to find factorial of a number using
OUTPUT:
15
13. Write a python program to that accepts length of three sides of a
triangle as inputs. The program should indicate whether or not the
triangle is a right-angled triangle (use Pythagorean theorem):
Source code:
Output:
16
14. Write a python program to define a module to find
Fibonacci Numbers and import the module to another
program.
Source code:
17
Output:
18
15. Write a python program to define a module and import a
specific function in that module to another program.
Source code:
19
Output:
20
16. Write a script named copyfile.py. This script should prompt the
user for the names of two text files. Thhe contents of the first file
should be innput and written to the second file.
Source code:
21
17. Write a program that inputs a text file. The program should print
all of the unique words in the file in alphabetical order.
Source code:
22
18. Write a Python class to convert an integer to a roman
23
19. Write a Python class to implement pow(x, n)
24
20. Write a Python class too reverse a string word
25
25