0% found this document useful (0 votes)
3 views11 pages

Python_Complete_Program_List

The document outlines a comprehensive curriculum for Advanced Python Programming, detailing various practical sets that cover fundamental concepts such as data types, conditional statements, loops, functions, string operations, lists, tuples, sets, dictionaries, file operations, and data plotting. Each practical set includes specific programming tasks aimed at reinforcing the concepts taught. The document serves as a guide for learners to develop their Python programming skills through hands-on exercises.

Uploaded by

Anuradha Dhavala
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)
3 views11 pages

Python_Complete_Program_List

The document outlines a comprehensive curriculum for Advanced Python Programming, detailing various practical sets that cover fundamental concepts such as data types, conditional statements, loops, functions, string operations, lists, tuples, sets, dictionaries, file operations, and data plotting. Each practical set includes specific programming tasks aimed at reinforcing the concepts taught. The document serves as a guide for learners to develop their Python programming skills through hands-on exercises.

Uploaded by

Anuradha Dhavala
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/ 11

c-tag

Advance Python Programming

Basics of Python Programming


(Data types, Operators, Expressions, Input/Output)
Practical Set - 1
1. WAP to print ‘Hello World!’
a. Print your name, age, and city in a single line using commas as separators.
b. Print the following numbers separated by a hyphen (-):
1-2-3-4-5
c. Print the following using three print functions but output statement should be in
one line.
Python is amazing!
d. Print the following statement as shown.
Hello
World
Python
2. WAP to find an area of a circle for a given radius.
3. WAP to interchange the value of given two variables.
4. WAP to find an average of three variables.
5. WAP to convert temperature in Celsius to Fahrenheit temperature.
C = (f-32)/1.8
f = 1.8*C + 32

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

Conditional Statements in 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

(While and For loop)

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.

7. WAP to enter a binary number and convert it into decimal number.


8. WAP to calculate the factorial of a number.
9. WAP to print the multiplication table of a given number.
10. WAP to calculate square root of a number. Demonstrate the use of break and continue statement.
11. WAP to demonstrate pass statement.

C-TAG 9824502039
c-tag
Advance Python Programming

(Functions and Modules)


Practical Set : 1
1. Write functions to find addition, subtraction, multiplication, and division of two given
numbers.
2. Write a function to determine numbers of seconds for a given day.
3. Write a function to calculate the volume of a cuboid using default arguments.
4. Write a function that returns the area and perimeter of a rectangle. Print the area and
perimeter of the rectangle.
5. Write a function to demonstrate local and global variables.
6. WAP to find the roots of a quadratic equation ax2 + bx + c. (using math module)
7. WAP to find a random decimal number between 1 and 10 with two places of accuracy for
example 1.23, 3.45.
8. WAP to print the sum of the following nth series:
a. 1 + ½2 + … + 1/n2
b. 1 + (1+2) + (1+2+3) + … + (1 + 2+ … + n)
c. sinx = x – x3/3! + x5/5! – x7/7! + x9/9!

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

(Lists and Tuples)


Practical Set : 1
1. WAP to demonstrate the indexing and slicing of a list and tuple.
2. WAP to iterate an element of list and tuple using for and while loops.
3. WAP that creates a list of 10 random integers. Then create two lists of all odd and even
numbers from it.
4. WAP that creates a list of words by combining the words in two individual lists.
5. WAP to remove all duplicates from a list.
6. WAP to combine values in two lists using list comprehension. Combine only those values
of a list that are multiples of values in the first list.
7. WAP using filter() function to filter out only even numbers from a list.
8. WAP using map() function to create a list of squares of numbers in the range 1 to 10.
9. WAP to demonstrate the use of zip() and enumerate() functions.
10. WAP to add two matrices (using nested lists).
11. WAP to return the highest and lowest values in the list.

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

(Sets and Dictionary)


Practical Set : 1
1. Write a program that generates a set of prime numbers and another set of odd
numbers. Demonstrate the result of union, intersection, difference, and
symmetric difference operations on these sets.
2. Write a program that creates two sets. One of even number in range 1-10 and the
other has all composite numbers in range 1-20. Demonstrate the use of all(),
isuperset(), len(), sum(), update(), pop(), remove(), add() and clear() functions on
sets.
3. Write a Python program to check if a given value is present in a set or not.
4. WAP to access values stored in a dict, add a new item in the dict, modify an item
in the dict, remove an element from dict.
5. WAP to access items in a dictionary using for loop.
6. WAP to demonstrate the use of various in-built functions in dictionary.
7. WAP that combines the lists to a dictionary using zip function
8. Write a Python script to print a dictionary where the keys are numbers between 1
and 15 (both included) and the values are the square of the keys.
9. WAP that creates a dictionary of radius of a circle and its circumference.
10. WAP that creates a dictionary of cubes of odd numbers in the range 1 to 10 using
dictionary comprehensions.
11. WAP that has dictionary of names of students and a list of their marks in 4
subjects. Create another dictionary from this dict that has names of the students
and their total marks. Find out the topper and his/her score.
12. WAP that prints histogram of frequencies of characters occurring in a message.
13. WAP that displays information about an employee. Use nested dictionary to do
the task. Also determine how to access an element in a nested dictionary and
how to add an element in nested dictionary.
Write a program that keeps name and phone numbers in a dictionary as key-value pairs.
The program should display a menu that lets the user search a person’s phone, add a
new name and phone number, change an existing phone number, and delete an existing
name and phone number.

C-TAG 9824502039
c-tag
Advance Python Programming

(File operations and Plotting Data)


Practical Set : 1
1. WAP to demonstrate open, read, write and close .txt and .csv files. In addition,
perform the following tasks:
a. Add a line “Hello World! I am using python” in existing .txt file.
b. Add following rows and columns in existing .csv file.
Roll No. Name Department Course
11021 Mahek CSE Python
11022 Heer ICT Mathematics
11023 Pavan CIE Physics
11024 Moksh ICT Data Structure

2. WAP for considering the following instructions:


a. Create a text file named "input.txt" and write some text data into it.
b. Write a Python program that opens the "input.txt" file for reading, reads the
contents of the file, and prints them to the console.
c. Open another text file named "output.txt" for writing, and write the
contents read from "input.txt" into "output.txt".
d. Finally, close both files after reading from and writing to them.
3. WAP to demonstrate exceptions in python considering ZeroDivisionError,
ValueError, AttributeError, NameError, ImportError, IOError.
4. WAP that asks the user to input two numbers and following information:
a. Try to convert the user inputs to integers and perform division operation
(num1 / num2).
b. Handle any possible exceptions that may occur during the conversion or
division operation.
c. Print appropriate error messages for each type of exception (e.g.,
ValueError, ZeroDivisionError), if it occurs.
d. Ensure that the program continues to execute even if an exception occurs.
5. WAP to demonstrate pickling process without file and with file using pickledump()
and pickleload() functions.

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.

(Python Libraries - NumPy and Pandas)


Practical Set : 1
1. Write a NumPy program to create a 3X4 array and iterate over it.
2. Write a NumPy program to create a 3x4 matrix filled with values from 10 to 21.
3. Write a NumPy program to create a 10x10 matrix, in which the elements on the borders
will be equal to 1, and inside 0.
4. Write a Python function that takes two 2D arrays as input and returns their matrix
product using NumPy.
5. Write a Python function that takes a 1D NumPy array as input and returns a new array
with all even numbers squared and odd numbers unchanged.
6. Write a NumPy program to compute the sum of all elements, the sum of each column
and the sum of each row in a given array.
7. Write a NumPy program to add a vector to each row of a given matrix.
8. Consider a given series:
QTR1 50000

QTR2 65890

C-TAG 9824502039
c-tag
Advance Python Programming

QTR3 56780

QTR4 89000

QTR5 77900

Write a program in Python Pandas to create and display the series.


9. Write a Pandas program to add, subtract, multiple and divide two Pandas Series.
10. Write a Pandas program to convert given series into a dataframe with its index as
another column on the dataframe.
11. Write a Pandas program to iterate over rows in a DataFrame.
12. Write a Pandas program to rename columns of a given DataFrame.
13. Write a Pandas program to add one row in an existing DataFrame.
14. Write a Pandas program to write a DataFrame to CSV file using tab separator.
15. Write a Pandas program to find the row for where the value of a given column is
maximum.

C-TAG 9824502039

You might also like