0% found this document useful (0 votes)
7 views2 pages

Lab - PGM 1

The document outlines a series of Python programming tasks, including calculating weights, generating patterns, and performing various mathematical operations. It also includes tasks related to data structures such as lists, tuples, and dictionaries, as well as file handling and exception management. Each task is designed to enhance programming skills through practical implementation of concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Lab - PGM 1

The document outlines a series of Python programming tasks, including calculating weights, generating patterns, and performing various mathematical operations. It also includes tasks related to data structures such as lists, tuples, and dictionaries, as well as file handling and exception management. Each task is designed to enhance programming skills through practical implementation of concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 ) a) Write a Python program to calculate the weight of the steel bar and develop a flow chart for the

same.
b) Write a Python program to circulate the values of n variables

2) a) Write a Python program to print the below Pyramid


*
**
***
****
*****

b)Write a Python program to calculate Simple Interest, Compound Interest

3) a) Write a Python Program to get the 5 bank customer account details with balance and printonly the
customer details whose balance is greater than or equal to 10000
b) Write a python program to define a module to find Fibonacci Numbers and import the moduleto another
program.

4) a) Write a Python program that prints out the decimal equivalents of 1/2, 1/3, 1/4, . . . ,Using for loop
b)Write a Python Program to print the Following number Pattern
55555
4444
333
22
1

5) a) Write a Python program to Remove the Duplicate Element in the Tuple

b) Write a Python script to print a dictionary where the keys are numbers between 1 and 15
and the values are square of keys
Sample Dictionary {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81, 10: 100, 11: 121,
12: 144, 13: 169, 14: 196, 15: 225}

6) a)Write a Python Program to Capitalize each word in a given String

b) Write a Python program to create a dictionary from a string and count the letters from the
string. Sample string : 'ENGINEERING'
Expected output: {'E': 3, 'N': 3, 'G': 2, 'I': 2, 'R': 1}

7) a) Write a Python Program to Calculate the Weight of the Motor Bike.

b) Write a Python Program to raise ZeroDivisionError if the User enters 0 as numerator or


Denominator value. 8. a) Write a Python program that accepts a comma separated sequence of words as input
andprints the unique words in sorted form.

8. a) Write a Python program that accepts a comma separated sequence of words as input andprints the
unique words in sorted form.

b) Write a Python program to print the sum of first 100 odd numbers.

9. a) 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):

b) Write a Python Program to Print all Prime numbers less than 50.

10. a) Define a function fact and write a python Script to find the factorial of a number

b) Write a Python Program to implement the following Python tuple operation

i) Create a Tuple
ii) Find the length of the Tuple
iii) find the maximum and minimum element in the tuple

11. a) Write a program to create a menu with the following options

1.ADDITITON OPERATION
2.SUBSTRACTION OPERATION
3.MULTIPICATION OPERATION
4.DIVISION OPERATION
Accepts users input and perform the operation accordingly.

b) Write a Python Program to Compute Electrical current in a three Phase Electrical Circuit

12. a) Write a Python Program to find the Third Largest number in a given list using Functions.

b) Write a Python program to implement the following python List operation


i) Inserting the element at the specified positions
ii)Remove the element in the List
iii)Delete the entire List
iv)Position of the particular Element in a Given List

13. a) Write a Python function to reverses a string if it's length is a multiple of 3.

b) Write a Python Program to count the number of Words present in a text file.

14. a) Create three text file such as “source1.txt”,”source2.txt”, in read mode , “target.txt” in write
mode and write a Python Script to copy the content of “source1.txt”,”source2.txt”, and write
the content in “target.txt file”.

b) Write a Python code to get the voters age as input. If the user Enters a Valid age as input
Display the Result otherwise Raise the Exception.

15. a) Create a dictionary and apply the following operations

1) Print the dictionary elements


2) Access the dictionary elements
3) Change values of the dictionary
4) Calculate the Length of the Dictionary

b) Write a Python program to display the current date and time. In the Following format. .:
2022-06-06 15:35:15. 16. a) Write a Python program to append text to a file and display the text in the output
screen.

16. a) Write a Python program to append text to a file and display the text in the output screen.

b) Write a Python program which accepts the user's first and last name and print them in
reverse order with a space between them.

17. a) Write the Python program To compute sin(x) using the below given Formula

sin x = x - x3/3! + x5/5! - x7/7! + x9/9! ........

b) Write a Python program to Exchange the Values of two Variables.

You might also like