Skip to content

Instantly share code, notes, and snippets.

@michael1011
Created August 24, 2015 17:03
Show Gist options
  • Save michael1011/b01bc7b3f68ba371325d to your computer and use it in GitHub Desktop.
Save michael1011/b01bc7b3f68ba371325d to your computer and use it in GitHub Desktop.
# Quiz
# Globale Einstellung
def quizfrage():
global punkte
antwort = input(frage)
if antwort == loesung:
print("Richtig")
punkte = punkte + 1
else:
print("Leider falsch!")
print("Richig ist:", loesung)
print
punkte = 0
# Frage 1
frage = "Welche Programmiersprache ist das?"
loesung = "Python"
quizfrage()
print()
# Frage 2
frage = "Mit welchem reservierten Wort
beginnt eine Funktionsdefinition?"
loesung = "def"
quizfrage()
print()
# Frage 3
frage = "Wie viele reservierte Worte hat Python?"
loesung = "30"
quizfrage()
print()
# Ergebnis
print("Du hast:", punkte, "von 3 möglichen Punkten erreicht.")
if punkte == 3:
print("Super!")
elif punkte > 0:
print("Du hast schon einiges gelernt.")
elif punkte == 0:
print("Du bist noch ziemlich am Anfang!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment