0% found this document useful (0 votes)
2 views

python

This document is a practical file for a Python course at Government College Sector-9, Gurugram, containing a list of programming exercises. Each exercise includes tasks such as demonstrating data types, performing arithmetic operations, working with strings, lists, tuples, dictionaries, and implementing various algorithms. The file serves as a guide for students to practice and showcase their Python programming skills.

Uploaded by

muskan11825
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

python

This document is a practical file for a Python course at Government College Sector-9, Gurugram, containing a list of programming exercises. Each exercise includes tasks such as demonstrating data types, performing arithmetic operations, working with strings, lists, tuples, dictionaries, and implementing various algorithms. The file serves as a guide for students to practice and showcase their Python programming skills.

Uploaded by

muskan11825
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

GOVERNMENT COLLEGE SECTOR-9,

GURUGRAM

PRACTICAL FILE
OF
PYTHON

1
INDEX

Sr.
PROGRAMS PAGE NO. Date Sign
NO

Write a program to demonstrate


1. 4
different number datatypes in
python.

Write a program to perform different


2. 5
arithmetic operations on numbers in
python.
Write a program to create, concatenate
3. and print a string and accessing 6
sub-string from a given string.

Write a python script to print the current


4. date in following format “Sun May 29 7
02:26:23 IST 2017”

Write a python program to create,


5. 8
append and remove lists in
python.

Write a program to demonstrate


6. 9
working with tuples in python

Write a program to demonstrate


7. 10
working with dictionaries in
python

Write a python program to find largest


8. 11
of three numbers

Write a python program to convert


9. temperature to and from Celsius to 12
Fahrenheit.

Write a python program to construct


10. 13
the following pattern using nested for
loop:

2
Write a python program to print prim
11. 14
numbers less than 20

Write a python program to find factorial of


12. 15
a number using recursion

Write a python program to that accepts


length of three sides of a triangle as
13. inputs. The program should indicate 16
whether or not the triangle is a
right-angled triangle (use
Pythagorean theorem):
Write a python program to define a
14. module to find Fibonacci Numbers and 17-18
import the module to another program

Write a python program to define a


15. module and import a specific function in 19-20
that module to another program.
Write a script named copyfile.py. This
script should prompt the user for the
16. names of two text files. Thhe contents of 21
the first file should be innput and written
to the second
file.
Write a program that inputs a text file.
17 The program should print all of the 22
unique words in the file in alphabetical
order

Write a Python class to convert an integer


18 23
to a roman numeral.

19 Write a Python class to implement pow(x, 24


n)

Write a Python class too reverse a string


20 25
word by word

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

python. Source code:

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

than 20: Source code:

Output:

14
12. Write a python program to find factorial of a number using

recursion: Source code:

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

numeral. Source code:

23
19. Write a Python class to implement pow(x, n)

24
20. Write a Python class too reverse a string word

by word. Source code:

25
25

You might also like