My Python Quiz
score = 0
username = input('Enter your name:')
print('Hello, ' + username)
ready = input("This quiz will test your knowledge of python vocabulary. It is four questions long. Are you ready to take the test? Answer yes or no")
if ready == 'yes':
print("Great, let's get started")
else:
print("Don't worry, you'll do great")
#question 1:
answer_1 = input("Question 1: What is a statement containing if or if/else called?")
if answer_1 == 'conditional':
print("Correct! Time for the next question")
score = score + 1
else:
print("No! That is incorrect")
#question 2:
answer_2 = input("Question 2: Fill in the blank: ___ is a datatype with only two possible values; true or false")
if answer_2 == 'boolean':
print("Correct! Time for the next question")
score = score + 1
else:
print("No! That is incorrect")
#question 3:
answer_3 = input("Question 3: What should you write before a function to DEFine it")
if answer_3 == 'def':
print("Correct! Time for the next question")
score = score + 1
else:
print("No! That is incorrect")
#question 4:
answer_4 = input("Question 4: What can you use to store values?")
if answer_4 == 'variable':
print("Correct! Time for the next question")
score = score + 1
else:
print("No! That is incorrect")
#end
if score >= 3:
print("Congrats! You finished the quiz and did so well! Your score is: {}/4" .format(score))
else:
print("Congrats! You finished the quiz. Your score is: {}/4. Better luck next time" .format(score))