Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
quiz3 [2013/04/08 20:50] admin |
quiz3 [2014/03/09 21:25] (aktuell) admin |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Quiz 3 ====== | ====== Quiz 3 ====== | ||
| - | <code python> | + | <code python quiz3.py> |
| - | # Python für Kids -- 4. Auflage, Kapitel 4 | + | |
| - | # Autor: Gregor Lingl | + | |
| - | # Datum: 6. 8. 2009 | + | |
| - | # miniquiz03.py : (3) - mit drei Fragen | + | |
| punkte = 0 | punkte = 0 | ||
| frage = "Welche Programmiersprache lernst du gerade? " | frage = "Welche Programmiersprache lernst du gerade? " | ||
| loesung = "Python" | loesung = "Python" | ||
| - | antwort = input(frage) | + | antwort = raw_input(frage) |
| if antwort == loesung: | if antwort == loesung: | ||
| print("Richtig!") | print("Richtig!") | ||
| Zeile 19: | Zeile 14: | ||
| frage = """Mit welchem reservierten Wort beginnt eine | frage = """Mit welchem reservierten Wort beginnt eine | ||
| - | |||
| Funktionsdefinition? """ | Funktionsdefinition? """ | ||
| - | |||
| loesung = "def" | loesung = "def" | ||
| - | + | antwort = raw_input(frage) | |
| - | antwort = input(frage) | + | |
| if antwort == loesung: | if antwort == loesung: | ||
| - | |||
| print("Richtig!") | print("Richtig!") | ||
| - | |||
| punkte = punkte + 1 | punkte = punkte + 1 | ||
| - | |||
| else: | else: | ||
| - | |||
| print("Leider falsch!") | print("Leider falsch!") | ||
| - | |||
| print("Richtig ist:", loesung) | print("Richtig ist:", loesung) | ||
| - | |||
| print() | print() | ||
| frage = "Wieviel reservierte Wörter hat Python? " | frage = "Wieviel reservierte Wörter hat Python? " | ||
| - | |||
| loesung = "33" | loesung = "33" | ||
| - | + | antwort = raw_input(frage) | |
| - | antwort = input(frage) | + | |
| if antwort == loesung: | if antwort == loesung: | ||
| - | |||
| print("Richtig!") | print("Richtig!") | ||
| - | |||
| punkte = punkte + 1 | punkte = punkte + 1 | ||
| - | |||
| else: | else: | ||
| - | |||
| print("Leider falsch!") | print("Leider falsch!") | ||
| - | |||
| print("Richtig ist:", loesung) | print("Richtig ist:", loesung) | ||
| - | |||
| print() | print() | ||
| - | |||
| print("Du hast", punkte, "von 3 Punkten erreicht!") | print("Du hast", punkte, "von 3 Punkten erreicht!") | ||
| - | |||
| </code> | </code> | ||