Title
import getpass, sys
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
#defines question with response as prompt and says what the value of msg is
questions = 4
correct = 0
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("Time for " + str(questions) + " questions.")
rsp = question_with_response("What command is used to repeat exactly what you've just said?")
if rsp == "echo":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
#if else statement in case of incorrect answer
rsp = question_with_response("What is five times seven?")
if rsp == "35":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
#if else in case of incorrect answer
rsp = question_with_response("Post files must be named in ____ format in order to go through")
if rsp == "YYYY-MM-DD.md":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
# see above reasoning
rsp = question_with_response("What is the syntax for adding images to your blog?")
if rsp == "![]{{site.baseurl}}/images/image.png":
print(rsp + " is correct!")
correct += 1
else:
print(rsp + " is incorrect!")
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
#prints the username as well as the score out of the total
print(getpass.getuser() + "you scored" + str((correct / questions))*100