Problem the names of various movies nominated for a prize, and the people who sh
ID: 3709621 • Letter: P
Question
Problem the names of various movies nominated for a prize, and the people who should be announced as the recpient. The file will look like this: title,director (s) Schindler's List,Steven Spielberg "O Brother, Where Art Thou?", "Joel Coen, Ethan Coen" 2001: A Space Odyssey, Stanley Kubrick "sherlock, 3r.", "Buster Keaton, Roscoe Arbuckle" You should write a program that reads in nominees.csv, asks for the name of the winning title, and prints out specific congratulations. For example, with the above file, your program should work like this: Winning title: o Brother, Where Art Thou? Congratulations: Joel Coen, Ethan Coen Here is another example, using the same file: Winning title: Schindler's List Congratulations: Steven Spielberg Remember Type here to searchExplanation / Answer
file = open("nominees.csv","r")
inp = input("Winning title :")
str1 = ""
for line in file:
if inp in line:
str1 = "Congratulations: "
if '","' in line:
list = line.split('","')
else:
list = line.split(",")
for i in range(1,len(list)):
str2 = list[i].replace('"','');
str1 = str1 + str2
break
print(str1)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.