Python Pograms
Computer Science (083)
Class XI
1. Write a Python program that reads a line and prints its statistic like:
Number of uppercase letters:
Number of lowercase letters:
Number of alphabets:
Number of digits:
Number of symbols:
2. Write a Python program to convert a string more than one word into
title case string where string is passed as parameter. (Title case means
that the first letter of each word is capitalised)
3. Write a Python program that takes a sentence as an input where each
word in the sentence is separated by a space. The function should
replace each blank with a hyphen and then print the modified sentence.
4. Write a Python program that inputs a list, replicates it twice and then
prints the sorted list in ascending and descending orders.
5. Write a Python program to input two lists and display the maximum
element from the elements of both the lists combined, along with its
index in its list.
6. Write a Python program to input a 4-element tuple and unpack it to four
variables. Then create the tuple with elements swapped as 1st element
with 3rd and the 2nd element with the 4th element.
7. Write a Python program to print the index of the minimum element in a
tuple.
8. A tuple t1 stores (11, 21, 31, 42, 51), where its second last element is
mistyped. Write a Python program to correct its second last element as
41.
9. Write a Python program to read roll numbers and marks of four students
and create a dictionary from it having roll number as keys.
10. Write a Python program to create phone dictionary for all your friends
and print each key value pair in separate lines.