Skip to content
Snippets Groups Projects
Commit c1ed3a2b authored by unknown's avatar unknown
Browse files

test

parent ddf9df7d
No related branches found
No related tags found
No related merge requests found
import random
class question:
def __init__(self, q, a):
self.q = q
self.a = a
def __str__(self):
return f"{self.q}, {self.a}"
q1 = question("Testquestion?", "Testanswer")
q2 = question("Testquestion2?", "Testanswer2")
q3 = question("Testquestion?3", "Testanswer3")
questions = [q1, q2, q3]
questionCount = 0
correctCount = 0
while True:
if questionCount < 11:
guestion = random.choice(questions)
print(guestion.q)
answer = input("Enter your answer here: ")
if answer == guestion.a:
print("Correct!")
correctCount += 1
else:
print("Wrong!")
questionCount += 1
else:
if correctCount == 10:
print(f"You scored {correctCount}/10! Great job!")
elif correctCount > 8:
print(f"You scored {correctCount}/10! Not bad!")
elif correctCount > 5:
print(f"You scored {correctCount}/10! You can definitely do better!")
elif correctCount > 0:
print(f"You scored {correctCount}/10! That wasn't good, better luck next time!")
else:
print(f"You scored {correctCount}/10! You should at least try next time...")
break
\ No newline at end of file
......@@ -4,7 +4,7 @@ class Car:
self.model = model
self.price = price
def __str__(self):
return f"{self.brand} {self.model} {str(self.price)}"
return f"{self.brand} {self.model} {self.price}"
car1 = Car("Skoda", "Octavia", 3000)
car2 = Car("Audi", "A4", 4000)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment