Created
August 24, 2015 17:03
-
-
Save michael1011/b01bc7b3f68ba371325d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
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