Python Assignments (1) - Copy
Python Assignments (1) - Copy
○ Input 5 numbers from the user and store them in a list. Then print the list.
○ Create a tuple of 6 items and print its length using len() function.
○ Write a program to calculate the sum of all elements in a list using a for
loop.
○ Create a dictionary with keys as subjects and values as marks. Print marks
for a given subject.
○ Input a list of 10 numbers and print only the even ones using a while loop.
○ Write a program to find the maximum and minimum values from a list
without using built-in max() or min().
○ Ask user for an item and check whether it exists in a given tuple or not.
○ Input a list and create a dictionary where keys are elements and values are
their frequency.
● Use a dictionary where keys are student names and values are lists of 3 marks.
● Input a list with repeated values and create a new list with unique values only
(without using set()).
● Sort a list of numbers in ascending order using a loop (no built-in sort).
● Input a sentence from the user and count the frequency of each word using a
dictionary.
15.Search in Nested Dictionary
●
● Ask user to input a student name and subject, and display the corresponding
mark.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
======================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Greet User
● Input two numbers and print which one is greater or if they are equal.
Voting Eligibility Checker
● Input age, check if the user is eligible to vote (age ≥ 18).
Grade Calculator
■ Is it even?
■ Is it divisible by 5?
○ Input username and password. If both match hardcoded values, print "Login
Successful", otherwise "Login Failed".
● Input three numbers and find the largest one using if, elif, and else.