0% found this document useful (0 votes)
3 views2 pages

Python 5 Programs Questions

The document outlines five Python programming tasks related to student marks analysis, string methods, shopping cart management, favorite colors using tuples, and student records with sets and dictionaries. Each program includes specific requirements, such as calculating grades, manipulating strings, managing lists and tuples, and handling data structures. Additionally, it poses questions regarding the functionality of various methods and expected outputs based on user input.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Python 5 Programs Questions

The document outlines five Python programming tasks related to student marks analysis, string methods, shopping cart management, favorite colors using tuples, and student records with sets and dictionaries. Each program includes specific requirements, such as calculating grades, manipulating strings, managing lists and tuples, and handling data structures. Additionally, it poses questions regarding the functionality of various methods and expected outputs based on user input.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Program 1: Student Marks Analysis

1. Write a Python program to accept student name and marks and print the grade.

2. What grade will be printed if the marks are 95?

3. What grade will be printed if the marks are 76?

4. What grade will be printed if the marks are 55?

5. What grade will be printed if the marks are 40?

6. Why is int() used for marks?

7. Modify the program to print “Excellent” if the grade is A.

8. Change the condition so that the pass mark is 60.

Program 2: String Methods Program


9. Write a Python program to read a word and print it in uppercase and lowercase.

10. What is the use of upper() method?

11. What is the use of lower() method?

12. What does len() return?

13. What will be the output if the input is “Python”?

14. When will the program print “Word is long”?

15. Modify the program to check word length greater than 8.

16. Write the output if the input is “cat”.

Program 3: Shopping Cart (List)


17. Write a Python program to create a shopping cart list and add an item.

18. What is the use of append() method?

19. How does the program check whether “apple” is in the list?

20. What will be the output if the user enters “orange”?

21. What does len(cart) return?

22. What happens if the same item is added again?


23. Modify the program to check for “banana” instead of apple.

24. Write the cart output after adding “mango”.

Program 4: Favorite Colors (Tuple)


25. Write a Python program to create a tuple of colors.

26. What is the use of count() method in tuple?

27. What is the use of index() method?

28. What will be the output if the user enters “blue”?

29. What will be printed if the user enters “red”?

30. What happens if the entered color is not in the tuple?

31. Why can we not change tuple values?

32. Write the index position of “green”.

Program 5: Student Record (Set + Dictionary)


33. Write a Python program to create a set of subjects and add a new subject.

34. Why does a set not allow duplicate values?

35. What is the use of add() method in set?

36. What is stored in the dictionary student?

37. How do we access the student name from the dictionary?

38. What does len(subjects) return?

39. What will be the output after adding “English”?

40. Write one more key-value pair to the dictionary.

You might also like