PRACTICAL - PROGRAMs For 12
PRACTICAL - PROGRAMs For 12
(Execute and show output and copy program in lab record book & paste output
25. Cumulative sum of a list [a, b, c, …] is defined as [a, a+b, a+b+c…]. Write a program to accept a list
and find the cumulative sum list.
26. Write a program to accept a list from the user and print the following: (i) Frequencies of all the
elements of the list (ii) Elements that appear only once in the list (iii) Elements that occur more than
once in the list
27. Write a program that rotates the elements of a list so that the element at the first index moves to the
second index, the element at the second index to third and so on. The last element should move to the
first position.
28. Write a program to compute the standard deviation for the numeric samples collected in a tuple
named Samples. Use math. sqrt () for computing the square root and use the standard deviation formula
found
29. Write a menu driven program that accepts a tuple input having english strings or pig latin strings. if
english strings are present in the tuple, convert them to pig latin or vice versa.
30. Create a nested tuple to store the marks in 3 subjects for n students. Calculate the total marks and
average marks for each student and display these.
31. Write a program that repeatedly asks the user to enter a team name and the number of games that
the team has won and the number of games that the team has lost. Store this information in a dictionary
where the keys are the team names and the values are lists of the form [wins, losses]. Using the
dictionary:
i) Allow the user to enter a team name and print out the team’s winning percentage.
ii) Create a list whose entries are the number of wins of each team.
iii) Create a list of all those teams that have winning records
32. Simulate a lucky draw event by generating a random number from 1 to 100. Accept numbers from
three different users in the range 1 to 100. If the entered number matches the randomly generated
number, print, "Congratulations!". Else print, "Sorry! Better luck next time!".
33. Write a program that accepts a list and finds the mean, median, mode through element comparison
and math functions. The program should check if the mean, mode, median arrived at matches the values
obtained using the statistics module.