15. Movie Voting: The program gives a list of several films that are currently being released. Voted by the user for each movie.
Finally, the user's voting information is published in LST = [' Beijing meets Seattle ', ' Save Mr. Wu ', ' American past ', ' the beautiful legend of Sicily ']
Result: {' Beijing meets Seattle ': 99, ' Save Mr. Wu ': 80, ' The American Past ': 6, ' The Beautiful Tales of Sicily ': 23}
LST = ['Beijing meets Seattle','Save Mr. Wu','The American past','the beautiful legends of Sicily']new=[]dic= Dict.fromkeys (lst,0)#{' Beijing meets Seattle ': 0, ' Save Mr. Wu ': 0, ' The American past ': 0, ' The beautiful Tales of Sicily ': 0} while1: forI,jinchEnumerate (dic,1): Print(I,j) New.append (j) Choice= Input ('Please enter a serial number or a movie name to vote'). Strip ()ifchoice.isdigit (): Choice=int (choice)Print(new[choice-1]) Dic[new[choice-1]] + = 1elifChoiceinchDic:dic[choice]+ = 1elifChoice.upper () = ='Q': Print(DIC) Break Else: Print('The information you entered is wrong, please re-enter!') Print(DIC)
Python3.6 full Stack Development example [015]