Python Lab Internals
Python Lab Internals
4 i) Write a program to calculate compound interest when principal, rate and number of periods are given.
ii) Given coordinates (x1, y1), (x2, y2) find the distance between two points
5 Read name, address, email and phone number of a person through keyboard and print the details.
Week - 2: Operations
Print the below triangle using for loop.
5
44
333
2222
6 11111
7 Write a program to check whether the given input is digit or lowercase character or uppercase character or a special character (use 'if-else-if' ladder)
9 Python program to print all prime numbers in a given interval (use break)
10 Write a program to compute LCM of two numbers by taking input from the user
11 Write a program add.py that takes 2 numbers as command line arguments and prints its sum
Week - 3: Lists & Tuples
13 Write a function called gcd that takes parameters a and b and returns their greatest common divisor.
Write a function called palindrome that takes a string argument and returns True if it is a palindrome and False otherwise. Remember that you can
14 use the built-in function len to check the length of a string.
15 Find mean, median, mode for the given set of numbers in a list.
19 Write a function called is_sorted that takes a list as a parameter and returns True if the list is sorted in ascending order and False otherwise.
Write a function called has_duplicates that takes a list and returns True if there is any element that appears more than once. It should not modify
the original list. i). Write a function called remove_duplicates that takes a list and returns a new list with only the unique elements from the original.
Hint: they don’t have to be in the same order. ii). The wordlist I provided, words.txt, doesn’t contain single letter words. So you might want to add
“I”, “a”, and the empty string. iii). Write a python code to read dictionary values from the user. Construct a function to invert its content. i.e., keys
20 should be values and values should be keys.
i) Add a comma between the characters. If the given word is 'Apple', it should
become 'A,p,p,l,e'
ii) Remove the given word in all the places in a string?
iii) Write a function that takes a sentence as an input parameter and replaces the first
letter of every 21 word with the corresponding upper case letter and the rest of the letters in the word
by corresponding letters in lower case without using a built-in function?
21
22 Writes a recursive function that generates all binary strings of n-bit length
29 Write a function reverse to print the given list in the reverse order.
31 Write a program that raise an Exception ( divide by zero error,voter’s age validity
32 Write a program that raise an Exception as string(), student mark range validation)
34 Write a python code to read a phone number and email-id from the user and validate it for correctness.
37 Write a Python program to demonstrate the usage of Method Resolution Order (MRO) in multiple levels of Inheritance.
Week- 8: Files
38 Write a Python code to merge two given file contents into a third file.
39 Write a Python code to open a given file and construct a function to check for given words present in it and display on found.
40 Write a Python code to Read text from a text file, find the word with most number of occurrences
41 Write a function that reads a file file1 and displays the number of words, number of vowels, blank spaces, lower case letters and uppercase letters.
51 Python series
53 Write a GUI program to create a window wizard having two text labels, two text fields and two buttons as Submit and Reset.
54 Write a program to implement Digital Logic Gates – AND, OR, NOT, EX-OR
55 Write a program to implement Half Adder, Full Adder, and Parallel Adder