sadafsagheer@[Link].
in
Ques1: Write a program to take a string as input
• Count the number of: Vowels, Consonants, Digits
Ques2: Write a program to take a list of numbers from the user
• Print: Maximum value, Minimum value, Second largest number
Ques3: Write a program to Create a file [Link]
• Write 5 lines into it (user input) , Read the file and display its contents
Ques4: Write a program to Open a file
• Count Number of lines, Number of words, Number of characters
Ques5: Write a program to:
• Store student names in a file, Display only those names which start with a vowel
Ques6: Write a program to: Read a file,
• Display only those words which: Start with a capital letter, Have length greater
than 5
Ques7: Write a program to
• Create a function that: Reads a file, Copies only those lines which contain the
word "Python" into another file
Ques8: Write a program to
• Create a function that Takes two file names , Merges their content into a third file
Ques9: Write a program to:
• Read a file containing student names and marks (name marks)
• Create another file: Store only students who scored above average marks
Ques10: Write a program to:
• Read data from a file, Remove duplicate lines using a function, Store unique
lines into a new file
Ques11: Write a program to: Read a file containing sentences
• Create a function to: Extract only sentences that contain more than 5 words
By Sadaf Sagheer (Assistant Professor), Department of Computer Engineering, ZHCET,
AMU
sadafsagheer@[Link]
• Store them in another file
Ques12: Write a program to:
• Read a file containing mixed values (e.g., A 10 B 20 C 5)
• Create a function to: Extract only numbers, Find their sum and average
Ques13: Write a program to:
• Read student data: Name Marks
• Create a function to: Find second highest marks
• Display student(s) with second highest marks
Ques14: Write a program to:
• Read a file
• Create a function to: Convert odd lines → uppercase, Convert even lines →
lowercase
• Write result into another file
Ques15: Write a program to:
• Read a file
• Create a function to: Replace every word with, Its length
• Example: "Hello Python" → "5 6"
• Save result into another file
By Sadaf Sagheer (Assistant Professor), Department of Computer Engineering, ZHCET,
AMU