Laboratory Experiments:
Assignment -1: (Basic and condition checking)
1. Write a Python program to perform addition, subtraction, multiplication, integer division, float division, exponentiation, modulo division and average of integer numbers.
2. Write a Python program for finding the area of a Circle and rectangle.
3. Write a Python program to print the first place of any number taken by user.
4. Write a Python program to convert Fahrenheit into degree Celsius and vice versa.
5. Write a Python program to calculate the total amount of money (Rs./-) in the piggybank, given the coins of 10 coins of Rs.10, 5 coins of Rs.5, 15 coins of Rs.2 and 20 coins of Rs.1.
6. Write a Python program to check whether a number taken by user is even or odd.
7. Write a Python program to find largest number between three numbers.
8. Write a Python program to determine the character entered by the user.
9. Write a Python program to determine whether the character entered is a vowel or not.
Assignment-2: (While Looping)
1. Write a Python program to check whether a number taken by User is Armstrong or not.
2. Write a Python program to check given number is Prime or not.
3. Write a Python program to check any Year taken as input is a Leap Year or not.
4. Write a Python program to calculate sum of 'n' natural numbers.
5. Write a Python program to calculate factorial of a number passing using command line argument.
6. Write a Python program to check whether a number is Palindrome or not.
7. Write a Python program to print given pattern:
(a). *
* *
* * *
* * * *
(b). * * * *
* * *
* *
*
(c). 1
2 2
3 3 3
4 4 4 4
(d). A
A B
A B C
A B C D
Assignment-3: (Looping)
1. Write a Python program to calculate the roots of a quadratic equation.
2. Write a Python program to find the solution of this given Series -
1/!1 + 2/!2 + 3/!3 + 4/!4 + 5/!5 +..........+ n terms
3. Write a Python program to find the volume of a Cuboid.
4. Write a menu driven program to make a simple calculator (sum, sub, multy, div and sqrt operations)
5. Write a Python program to calculate Exponential of x and y.
6. Write a Python program to print a Fibonacci Series.
Assignment-4: (Looping & Functions)
1. Write a Python program to print Tribonacci Series (1, 1, 2, 4, 7, 13, 24, ……….) using user defined function.
2. Write a Python program to find Factorial of a number using user defined function.
3. Write a Python program to find Absolute value, Square root and Cube of a number using user defined function.
4. Write a Python program to find factorial of a number using recursion.
5. Write a Python program to print a Fibonacci Series using Recursion.
6. Write a Python program to check a given number is even or odd using Function.
Assignment-5: (Function & String)
1. Write a Python program to add two numbers using lambda function.
2. Write a Python program to find smaller of two numbers using lambda functions.
3. Write a Python program that take User's Name and Pan card number. Validate the taken information using
"isx()" function Print (Where 'x' is either Alpha or number , digit ).
4. Write a Python program to encrypt the message by adding a key value to every character (Caesar Cipher)
Input : H E L L O
+3
Output : K H O O R
5. Write a Python program that uses split() to split a Multiple String using new line.
6. Write a Python program that accept a String from User and Re-display the same after removing Vowels from it (use user defined function).
7. Write a Python program that counts the occurrence of Character in a String (Do not use built in 'count' function). Modify the above program so that it starts counting from Specified Location.
8. Write a Python program that finds whether a given Character is present in a String or not. In case it is present, it prints the Index at which it is present. (Don't use built in function)
Assignment-6: (String)
1. Write a Python program to reverse a string.
2. Write a Python program with the use of Split function.
3. Write a Python program to remove Vowels from a String.
Assignment-7: (Module)
1. Write a Python program to print date and time using time module and print the calendar of a particular month.
2. Write a Python program to print absolute value, square root and cube of a number using math module.
3. Define a factorial function in a user-defined module “MyFact” and use command line argument to find the factorial value of the input.
4. Write a Python program that defines a function large in a module which will be used to find larger of two values and called from code in another module.
Assignment-8: (List Programs)
1. Write a Python program to interchange the first and last element of a List.
2. Write a Python program to calculate length of a List.
3. Write a Python program to swap two elements of a list.
4. Write a Python program to check whether any element taken by user is exist in a list or not.
5. Write a Python program to reverse a list.
6. Write a Python program to Copy a List into another List.
7. Write a Python program to count occurrence of a particular element.
8. Write a Python program to add all numbers of a list.
9. Write a Python program to find Largest and smallest number of a List.
10. Write a Python program to find second largest number of a List.
11. Write a Python program to calculate number of Even and Odd elements in a List.
12. Write a Python program to calculate total positive and negative number of elements in a List.
13. Write a Python program to Sort the List elements.
Assignment-9: (File Handling)
1. Write a Python program to create a new blank file and write some new contents in that file using write and writeline both check.
2. Write a Python program to display the contents of a file.txt using read and readline methods.
3. Write a Python program to append some new contents for existing content of a file.
4. Write a Python program to display the contents of a file using List method.
5. Write a Python program to Split the line into a series of words.
6. Write a Python program to perform Split operation whenever a ,(comma) is counted.
7. Write a Python program that copies first 10 bytes of a file into an other file.
8. Write a Python program that reads Data from a file and calculates the percentage of vowels and consonants from the file.
Assignment-10: (Dictionary)
1. Write a Python program that combine the Lists into a Dictionary.(Using Zip())
2. Write a Python program to create a Dictionary of Odd numbers in the range of 1 to 10.
3. Write a Python program that creates two Dictionaries, One that stores conversion value from meter to centimeter and Second stores conversion value from centimeter to meter.
4. Write a Python program that creates a Dictionary of a Radius (that taken by user) and its Circumference for a Circle.
5. Write a Python program that calculates Fibonacci of N numbers using a Dictionary.
6. Write a Python program to store a Sparse Matrix.
Assignment-11 (Class & objects)
1. Write a Python program that uses class to store the names and marks of students and calculate the average marks of each student through object calling.
2. Write a Python program that has a class Circle. Use a class variable to define the value of constant PI. Use this class variable to calculate the area and circumference of a circle with specified radius.
3. Write a Python program that has a class Numbers with values stored in a list. Write a class method to find the largest value.
4. Write a Python program to deposit or withdraw money in a bank account using class “Account” and deposit(), withdraw().
Assignment-12 (Class Inheritance)
1. Write a Python program that has a parent class person, which has two variable name and age. Now create two subclasses Teacher and Student from person, which has experience, research area and course, marks variables respectively. Use a display_data() to access all the records of teacher and student classes.
2. Write a Python program that has an abstract lass Polygon. Derive two classes Rectangle and Triangle from Polygon and write methods to get the details of their dimensions and hence calculate the area.
Assignment-13 (Error and Exception)
1. Write a Python program to throw an exception zeroDivisionError in a division operation when the denominator is zero.
2. Write a Python program that prompts the user to enter a number. If the number is positive or zero print it, otherwise raise an exception ValueError.
3. Write a Python program which infinitely print natural numbers. Raise the StopIteration exception after displaying first 20 numbers to exit from the program.
4. Write a Python program that randomly generates a number. Raise a user-defined exception if the number is below 0.1.
5. Write a Python program to trap the user-defined constraint in Celsius to Fahrenheit conversion using assert exception statement.
6. Write a Python program that validates name and age as entered by the user to determine whether the person can cast vote or not.
Assignment-14 (Special Packages and Short Projects)
1. Use of Numpy array, Scipy, Pandas, scikit-learn, Matplotlib, Keras packages with some real life projects in Python.
Text Book(s):
1. Weingart, Dr. Troy, Brown, Dr. Wayne, An introduction to programming and algorithmic reasoning using raptor.
2. T R Padmanabhan, Programming with python, Springer.
3. Reema Thareja, Python Programming: Using Problem Solving Approach, Oxford University Press.
4. Wes McKinney , Python for Data Analysis, O.Reilly.