Python Quiz
<<<<<<< HEAD
=======
- title: Lists, Dictionaries, Iteration
- toc: true
- categories: [units]
- permalink: /collegeboard/python_lists
- image: /images/python_lists.png
- categories: [collegeboard]
- tags: [python]
>>>>>>> f44d76edc589c60593655631253fadb963713168
#define:
score = 0
questions = 4
def q_a(q, a):
answer = input(q)
score = 0
if answer == a:
print("Good job! That is correct!")
score = 1
else:
print("Good try! The answer is " + a + ".")
return score
#intro:
name = input("Enter your name:")
print("Hey! " + name)
ready = input("This quiz will have 4 questions." + " Are you ready to start this quiz? Answer yes or no.")
if ready == "yes":
print("Let's get started!")
else:
print("Good Luck!")
#question 1:
score = score + q_a("1. Are static texts changeable?", "No")
#question 2:
score = score + q_a("2. Where is output found in Jupyter Notebook?", "Below the code cell")
#question 3:
score = score + q_a("3. What are grouping a sequence of commands called?", "Procedural abstraction")
#question 4:
score = score + q_a("4. What are two or more lines that form a sequence called?", "Sequence of code")
#ending score
if score >= 3:
print("Congratulations! You completed this quiz with an amazing score! You scored a: {}/4" .format(score))
else:
print("Congratulations! You completed the quiz. Your score is a: {}/4" .format(score))