Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # geogeeks
- def spiel(c):
- # type: (object) -> object
- a = 0
- z = 0
- while z < len(c.keys()):
- x = c.keys()[0+z]
- y = c.values()[0+z]
- answer = raw_input("Was ist die Hauptstadt von " + x + "?")
- z += 1
- # raw_input("Was ist die Hauptstadt von %s ?"%k)
- if answer.lower() == y.lower():
- print "Das ist richtig!"
- a += 1
- else:
- print "Das ist falsch"
- a -= 1
- return a
- if __name__ == '__main__':
- # Dictionary mit Laendern und Hauptstaedten
- # hauptstadt_dict = dict()
- # hauptstadt_dict["Deutschland"] = "Berlin" oder
- hauptstadt_dict = {"Russland": "Moskau",
- "Deutschland": "Berlin",
- "Ungarn": "Budapest",
- "Italien": "Rom",
- "Oesterreich": "Wien"}
- b = spiel(hauptstadt_dict)
- print "Gratuliere, du hast %i Punkte erreicht" % b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement