Week 1 Questions
Week 1 project
import getpass, sys
questions = 3
correct = 0
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
def question_and_answer(prompt):
print("Question: " + prompt)
msg = input()
print("Answer: " + msg)
question_and_answer("what is your favorite class in school?")
question_and_answer("Do you like this class?")
question_and_answer("How has your day been?")
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
question_and_answer("Are you ready for some questions?")
rsp = question_with_response("Who is the creator of Apple?")
if rsp == "Steve Jobs":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("what is 10+40?")
if rsp == "50":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
rsp = question_with_response("Is Toby leeder the hotest of them all?")
if rsp == "yes":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))