The Quiz

This quiz uses variables to store the questions and answers, so you can change them right at the top of the file, all in one place. It also has 2 integers for tracking the amount of questions and how many correct answers

It also uses a for loop to iterate between these lists, changing the amount of correct answers if you get one correct.

After all of that it tells you your percentage of correct answers.

firstQ = 'What command is used to include other functions that are developed?'
secondQ = 'What command in this example is used to evaluate a response?'
thirdQ = "Each 'if' command contains an '_________' to determine a true or false condition?"
fourthQ = "What function is used to turn an int into a string?"
fifthQ = "What takes code someone else made so you can use it in your code?"

# Questions in a list
questions = [firstQ, secondQ, thirdQ, fourthQ, fifthQ]

# All of the answers
firstA = 'def'
secondA = 'if'
thirdA = 'expression'
fourthA = 'str'
fifthQ = 'import'

# Answers in a list
answers = [firstA, secondA, thirdA, fourthA, fifthQ]

# Variables to be used later
correct = 0
questionsAmount = len(questions)

# Main execution of code, runs based on how many questions there are
for x in range(questionsAmount):
    print(questions[x])
    resp = input()
    if resp == answers[x]:
        print("'" + resp + "' is right :)")
        correct += 1
    else:
        print('No, ' + "'" + resp + "' is incorrect, '" + answers[x] + "' is correct")

# Ending statement
print("You got " + str((correct/questionsAmount) * 100)[0:5] + "% of the questions correct")
What command is used to include other functions that are developed?
'def' is right :)
What command in this example is used to evaluate a response?
'if' is right :)
Each 'if' command contains an '_________' to determine a true or false condition?
'expression' is right :)
What function is used to turn an int into a string?
No, 'toString()' is incorrect, 'str' is correct
What takes code someone else made so you can use it in your code?
'import' is right :)
You got 80.0% of the questions correct