comments: true layout: post title: Quiz description: Fun Quiz! type: tangibles courses: { compsci: {week: 2} } —

import getpass, sys
def question_with_response(prompt):
    print("Question: " + prompt)
    msg = input()
    return msg
questions = 3
correct = 0
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
question_with_response("Are you ready to take a test?")
rsp = question_with_response("What is the largest state in The United States?")
if rsp == "alaska":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")
rsp = question_with_response("What is the longest river in The United States?")
if rsp == "missouri river":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")
rsp = question_with_response("What was the first state created in The United States")
if rsp == "delaware":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
Hello, kasm-user running /bin/python
You will be asked 3 questions.
Question: Are you ready to take a test?
Question: What is the largest state in The United States?
alaska is correct!
Question: What is the longest river in The United States?
missouri river is correct!
Question: What was the first state created in The United States
delaware is correct!
kasm-user you scored 3/3