#imports the libary
import getpass, sys
#defines the function
#promt is the questions
def question_with_response(prompt):
print("Question: " + prompt)
msg = input()
return msg
#variables
questions = 7
correct = 0
#into words
print('Hello, ' + getpass.getuser() + " running " + sys.executable)
print("You will be asked " + str(questions) + " questions.")
print("Are you ready to take a quiz about soccer?")
question = {
"questions": [ "What country was Lionel Messi born in?","What was Lionel Messi's first club?","Which club does Ángel Di María play for now (2022)?","Who won the Golden Boot at the 2022 FIFA World Cup in Qatar?","What club does Sadio Mané play for currently (2022)?","Which club's football academy did Jadon Sancho come through as a teenager?","Who is the current all-time top scorer for Finland?"]
}
Answers = {
"0" : ["argentina","Argentina", "Arg", "arg"],
"1" : ["grandoli", "Grandoli", "Grandoli FC", "grandoli fc"],
"2" : ["Benfica","benfica", "S.L. Benfica", "SL Benfica", "sl benfica", "s.l. benfica"],
"3" : ["Mbappé","mbappé", "Mbappe", "mbappe", "Kylian Mbappé", "kylian mbappé", "Kylian Mbappe", "kylian mbappe", "Ninja Turtle"],
"4" : ["Al Nassr","al nassr", "Al nassr", "Al-Nassr", "al-nassr", "AlNassr", "alnassr"],
"5" : ["Manchester City","manchester city", "Man City", "man city", "Manchester City FC", "manchester city fc", "Man city", "Manchester city"],
"6" : ["Teemu Pukki","teemu pukki", "Pukki", "pukki"]
}
q = -1
while q <6:
q += 1
rsp = question_with_response(question["questions"][q])
if rsp in Answers[str(q)]:
print( rsp + " is correct")
correct += 1
else:
print( rsp +(" is incorrect"))
# the value in the variable correct is divided by the value in the variable question and then multiplied by 100
# this value is saved in the variable percentage
percentage = correct/questions *100
if percentage < 50:
print(getpass.getuser() + " You failed.")
else:
print(getpass.getuser() +" You passed!")
#getpass.getuser() takes the user name and str converts the variable correct into a string
#this is the same with the variable question
print(getpass.getuser() + ", you scored " + str(correct) +"/" + str(questions) + ", which is a " + str(percentage) + "%!")
# To show the percentage, the calculated value in the variable "percentage" then convert into a string