Question

I’m trying something new with these types of problems, so please provide feedback if you have any. If you work through the “Build a Trivia Game” problems throughout the course’s tutorials, by the end...

I’m trying something new with these types of problems, so please provide feedback if
you have any. If you work through the “Build a Trivia Game” problems throughout the
course’s tutorials, by the end of the course you will have created a trivia game that
retrieves questions from the Internet, keeps track of a user’s score throughout a game,
and remembers the high scores forever.
This week, we will start with a simplified version of a trivia game (decomposition!) and
continue to add details in future weeks. For this week, write a program that prints out a
single trivia question that you made up, gets an answer from the user, and then tells
them if they were correct or not.
One thing you may want to consider is case sensitivity (e.g., “Ottawa” is not equal to
“ottawa”). We will talk about handling string data in more detail later, but for now all you
need to know is that Python has a way to convert strings to lower/upper case. If x is a
5
string variable, then x.upper() evaluates to the uppercase version of x. There is also
x.lower(). So if x = “Ottawa” and y = “otTAwa”, x does not equal y, but x.lower() equals
y.lower(). Like the int/float/str type conversions, this does not actually change the value
of x but only evaluates to the lowercase representation of x.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

question = input("\nWho is the President of America? ")

answer = "donald trump"

question = question.lower()

if(question == answer):

print("Correct answer!")

else:

print("Incorrect answer!")

******************************************************************* SCREENSHOT*********************************************************

Who is the President of America? Donald Trump Correct answer!

Who is the President of America? DONALD tRuMP Correct answer!

Who is the President of America? Barack Obama Incorrect answer!

Add a comment
Know the answer?
Add Answer to:
I’m trying something new with these types of problems, so please provide feedback if you have any. If you work through the “Build a Trivia Game” problems throughout the course’s tutorials, by the end...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT