Python_Complete_Program_List
Python_Complete_Program_List
Practical Set – 2
1. WAP to read the values of coefficients and/or variables from the user and print the output
for the following expressions:
a. y = ax2 + bx + c
b. a = (b + c)*(b – c)
c. A = -(R1/R2+R3)
d. I = (P*R*T)/100
2. WAP to accept the base and height of a triangle and compute its area.
3. WAP to calculate the midpoints of a line.
4. WAP to accept three numbers and print the sum of cube of three numbers.
5. WAP to calculate number of seconds in a day.
6. WAP to accept two integers x and y from the user and then display the output of x y.
7. WAP to calculate the total amount of money in the piggybank given the coins of Rs. 10, Rs
5, 2, 1
C-TAG 9824502039
c-tag
Advance Python Programming
Practical Set: 1
1. WAP to determine whether a given number is even or odd number.
2. WAP to display whether a given number is positive, negative or zero.
3. WAP to determine the largest of three numbers.
4. WAP to display the grade of student for a given mark.
Marks Grade
> 90 A
>80 B
>70 C
>60 D
>50 E
<50 FAIL
5. WAP to determine whether a person is eligible to vote or not. If he/she is not eligible,
display how many years are left to be eligible.
Practical Set: 2
1. WAP to check whether a given number is divisible by three, five and both three and five.
2. WAP that
a) Store correct password in a variable.
b) Asks user to enter his/her password.
c) Validate the two passwords:
a. Check if user has entered password. If not, then give message “Please enter your
password.”
b. Check if both passwords are same. If they are same, show message “Correct! The
entered password matches the original password.”
c. Show “Incorrect password” otherwise
3. WAP to enter any character. If entered character is in lowercase then convert it into uppercase
and if it is an uppercase, then convert it into lowercase.
4. WAP to check whether the character entered is a vowel or not.
5. WAP to read an angle from the user and then display its quadrant.
6. WAP to read two numbers. Then find out whether the first number is a multiple of the second
number.
C-TAG 9824502039
c-tag
Advance Python Programming
Practical Set : 1
1. WAP to read the numbers until -1 is encountered. Also count the negative, positives and zeroes
entered by the user.
2. WAP to enter a decimal number. Calculate and display the binary equivalent of this number.
3. WAP to print the reverse of a number. (using while loop)
4. WAP to find whether the given number is an Armstrong number. (An Armstrong number of three
digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For
example, 371 is an Armstrong number since 3^3 + 7^3 + 1^3 = 371)
5. WAP that asks the user to enter a password. If the user enters the right password, the program
should tell the user that ‘You are logged in to the system’. Otherwise, the program should tell to
reenter the password. The user should only get five tries to enter the password, after which the
program should tell the user that ‘Number of attempts exceeds, you cannot log in to the system’.
6. WAP to print the following patterns:
a. 1 b. 1
12 12
123 123
1234 1234
12345 12345
a. 1 c. * * * * *
121 * *
12321 * *
1234321 * *
123454321 * * * * *
b. 1 c. 1
01 121
101 12312
0101 121
10101 1
d.
C-TAG 9824502039
c-tag
Advance Python Programming
Practical Set : 2
8. Write a function to determine an average of given numbers in arguments.
9. Write a function that gives numbers of words of a given string.
10. Write a function that converts time into minutes.
11. Write a function that displays “Hello name”, for any given name passed to it.
12. WAP that prints absolute value, square root and cube of a number.
13. WAP to determine sine, cosine and tangent of a given number.
14. WAP to print the sum of the following nth series:
a. cosx = 1 – x2/2! + x4/4! – x6/6! + x8/8!
b. 1 – x + x2/2! – x3/3! + … + xn/n!
15. WAP to check the validity of a password given by the user.
The password should satisfy the following criteria:
a) Contain at least 1 letter between a and z
b) Contain at least 1 number between 0 and 9
c) Contain at least 1 letter between A and Z
d) Contain at least 1 character from $, #, @
e) Minimum length of password: 6
f) Maximum length of password: 12
C-TAG 9824502039
c-tag
Advance Python Programming
(String Operations)
Practical Set : 1
1. WAP to demonstrate the indexing and slicing of a string.
2. WAP to print following pattern:
A
AB
ABC
ABCD
ABCDE
3. WAP to demonstrate the concatenation, appending and repeating operation on string
using +, += and * operators.
4. WAP to iterate a given string using while and for loop.
5. WAP to remove nth index character from a non-empty string.
6. WAP to calculate the length of a string. Do not use built in function len( ).
7. WAP to return a string in title case. Do not use built in function title( ). (If string is “The
world is beautiful”, program should return the string in title case as “The World Is
Beautiful”.)
8. WAP to check whether a string is a palindrome or not.
Practical Set : 2
1. WAP that accepts a string from user and redisplays the same string after removing vowels
from it.
2. WAP to find whether a given character is present in a string or not. In case it is present,
print the index at which it is present. Do not use built-in find function to search the
character.
3. WAP to count the occurrence of each word in a given sentence.
4. WAP to append a string to another string without using += operator.
5. Write a function to convert a given string to all uppercase if it contains at least 2 uppercase
characters in the first 4 characters.
6. WAP to remove existing indentation from all the lines in a given text.
7. WAP to demonstrate the use of various built-in functions such as count, find, isalnum,
isalpha, isdigit, islower, isupper, upper, lower, strip, replace, swapcase, join etc.
C-TAG 9824502039
c-tag
Advance Python Programming
Practical Set : 2
1. WAP to swap two values using tuple assignment.
2. WAP using a function that returns the area and circumference of a circle whose radius is
passed as an argument.
3. WAP using filter() function to a list of cubes of numbers from 1 – 10.
4. WAP that reverse a list using a loop.
5. WAP to find whether a particular element is present in the list using a loop.
6. WAP that prints all consonants in a string using list comprehension.
7. WAP that counts the number of times a value appears in the list. Use a loop to do the
same.
8. WAP to insert a value in the list at the specified location using while loop.
9. WAP to transpose two matrices.
C-TAG 9824502039
c-tag
Advance Python Programming
C-TAG 9824502039
c-tag
Advance Python Programming
C-TAG 9824502039
c-tag
Advance Python Programming
6. Write a Python program that defines a dictionary containing some data (e.g.,
student information, employee records, etc.).
a. Use the pickle module to serialize (i.e., convert) the dictionary into a binary
file.
b. Write a function that reads the serialized binary file using pickle and returns
the deserialized (i.e., converted back to its original form) dictionary.
c. Test your program by serializing the dictionary, writing it to a file, reading
the file using the function, and printing the deserialized dictionary.
7. WAP to plot line graph using following instructions:
a. Define two lists: one for the days of the week (e.g., Monday, Tuesday, etc.)
and another for the corresponding temperature data for each day.
b. Use Matplotlib to create a line graph where the x-axis represents the days
of the week and the y-axis represents the temperature.
c. Customize the appearance of the line graph by adding labels to the x-axis
and y-axis, adding a title, and adjusting the color and style of the line.
8. WAP to plot scatter graph using following instructions:
a. Define two lists: one for the hours studied by each student and another for
the corresponding exam scores.
b. Use Matplotlib to create a scatter graph where the x-axis represents the
hours studied and the y-axis represents the exam scores.
c. Customize the appearance of the scatter graph by adding labels to the x-axis
and y-axis, adding a title, and adjusting the marker style and color.
9. WAP to plot pie-chart using following instructions:
a. Define a dictionary where each key represents a grade (e.g., 'A', 'B', 'C',
etc.) and the corresponding value represents the number of students who
received that grade.
b. Use Matplotlib to create a pie chart where each slice represents a grade and
its size represents the proportion of students who received that grade.
c. Customize the appearance of the pie chart by adding labels to the slices,
adding a title, and adjusting the colors.
10. WAP to plot bar-chart using following instructions:
a. Define a dictionary where each key represents a product name and the
corresponding value represents the sales amount for that product.
b. Use Matplotlib to create a bar chart where each bar represents a product
and its height represents the sales amount.
C-TAG 9824502039
c-tag
Advance Python Programming
c. Customize the appearance of the bar chart by adding labels to the x-axis and
y-axis, adding a title, and adjusting the colors of the bars.
11. WAP to plot subplot using following instructions:
a. Use this sample data:
x = list(range(11)) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y1 = [0, 0.841, 0.909, 0.141, -0.757, -0.959, -0.279, 0.657, 0.989, 0.412, -
0.544] # Sample sine values
y2 = [1, 0.540, -0.416, -0.990, -0.654, 0.284, 0.960, 0.753, -0.145, -0.911, -
0.839] # Sample cosine values
y3 = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100] # Sample squared values
y4 = [1, 2.72, 7.39, 20.09, 54.6, 148.41, 403.43, 1096.63, 2980.96, 8103.08,
22026.47] # Sample exponential values
b. Use Matplotlib to create subplots with multiple plots arranged in a grid.
c. Customize the appearance of each subplot by adding labels, titles, and
adjusting the colors and styles of the plots.
QTR2 65890
C-TAG 9824502039
c-tag
Advance Python Programming
QTR3 56780
QTR4 89000
QTR5 77900
C-TAG 9824502039