Using python, can you help me solve this problem: Modify the Trivia Challenge Ch
ID: 645648 • Letter: U
Question
Using python, can you help me solve this problem:
Modify the Trivia Challenge Chapter Project from this chapter so that each question has
its own point value. In addition to modifying the Python code for the game program,
you will need to create a new trivia episode file, which you can base on trivia. txt, that
stores a point value for each question. Call this new episode file tri vi a2. txt and give
question one a point value of 5, question two a point value of 10, question three a point
value of 15, question four a point value of 20, and question five a point value of 25.
original trivia.py:
#Useless Trivia
#
#Gets personal information from the user and then
#prints true but useless information about him or her
name = raw_input("Hi. What's your name?")
age = int(raw_input("How old are you?")) #Corrected
weight = int(raw_input("Okay, last question. How many pounds do you weigh?"))
print(" If poet ee cummings were to email you, he'd address you as", name.lower()) #Corrected
print("But if ee were mad, he'd call you", name.upper())
called = name * 5
print(" If a small child were trying to get your attention")
print("your name would become:")
print(called)
seconds = age * 365 * 24 * 60 * 60
print(" You're over", seconds, "seconds old.")
moon_weight=weight / 6
print(" Did you know that on the moon you would weigh only", moon_weight, "pounds?") #Corrected
sun_weight=weight * 27.1
print("On the sun, you'd weigh", sun_weight,"(but, ah... not for long).")
raw_input(" Press the enter key to exit.")
Explanation / Answer
#Useless Trivia
#
#Gets personal information from the user and then
#prints true but useless information about him or her
f = open('triva2.txt', 'w')
name = raw_input("Hi. What's your name?")
value =10
s = str(value)
f.write(s)
age = int(raw_input("How old are you?")) #Corrected
value =15
s = str(value)
f.write(s)
weight = int(raw_input("Okay, last question. How many pounds do you weigh?"))
value =20
s = str(value)
f.write(s)
print(" If poet ee cummings were to email you, he'd address you as", name.lower()) #Corrected
print("But if ee were mad, he'd call you", name.upper())
called = name * 5
print(" If a small child were trying to get your attention")
print("your name would become:")
print(called)
seconds = age * 365 * 24 * 60 * 60
print(" You're over", seconds, "seconds old.")
moon_weight=weight / 6
print(" Did you know that on the moon you would weigh only", moon_weight, "pounds?") #Corrected
sun_weight=weight * 27.1
print("On the sun, you'd weigh", sun_weight,"(but, ah... not for long).")
raw_input(" Press the enter key to exit.")
value =25
s = str(value)
f.write(s)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.