Class 11 Computer Science – Python Practice Programs
Q1. Input a welcome message and display it.
Input: Welcome to Python
Output: Welcome to Python
Q2. Input two numbers and display the larger and smaller number.
Input: 10, 25
Output: Larger = 25, Smaller = 10
Q3. Input three numbers and display the largest and smallest number.
Input: 4, 9, 2
Output: Largest = 9, Smallest = 2
Q4. Pattern using nested loops (n=5).
Output:
*
**
***
****
*****
Q5. Series sum: 1 + x + x² + ... + x■
Input: x=2, n=4
Output: 31
Q6. Check Perfect, Armstrong, Palindrome number.
Input: 153
Output: Armstrong
Q7. Check Prime or Composite.
Input: 7
Output: Prime number
Q8. Fibonacci series (n=6).
Output: 0 1 1 2 3 5
Q9. GCD and LCM.
Input: 12, 18
Output: GCD=6, LCM=36
Q10. Count vowels, consonants, uppercase, lowercase.
Input: Hello
Output: Vowels=2, Consonants=3, Uppercase=1, Lowercase=4
Q11. String Palindrome and case conversion.
Input: madam
Output: Palindrome
Q12. Largest and smallest in list.
Input: [4, 7, 1]
Output: Largest=7, Smallest=1
Q13. Swap even-odd positions.
Input: [1,2,3,4]
Output: [2,1,4,3]
Q14. Search element in list.
Input: [5,8,2], Search=8
Output: Found
Q15. Sum of list elements.
Input: [2,4,6]
Output: 12
Q16. Marks above 75.
Input: {1:80, 2:60}
Output: Roll No 1
Q17. Sum of marks.
Input: {1:50, 2:60}
Output: 110
Q18. Delete employee record.
Input: E1:30000, E2:25000, delete E2
Q19. Maximum salary.
Input: E1:30000, E2:45000
Output: 45000
Q20. Passed students (≥40).
Input: A:55, B:35
Output: A Passed