Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. # geogeeks
  2.  
  3. def spiel(c):
  4. # type: (object) -> object
  5. a = 0
  6. z = 0
  7. while z < len(c.keys()):
  8. x = c.keys()[0+z]
  9. y = c.values()[0+z]
  10. answer = raw_input("Was ist die Hauptstadt von " + x + "?")
  11. z += 1
  12. # raw_input("Was ist die Hauptstadt von %s ?"%k)
  13.  
  14. if answer.lower() == y.lower():
  15. print "Das ist richtig!"
  16. a += 1
  17. else:
  18. print "Das ist falsch"
  19. a -= 1
  20.  
  21. return a
  22.  
  23. if __name__ == '__main__':
  24. # Dictionary mit Laendern und Hauptstaedten
  25.  
  26. # hauptstadt_dict = dict()
  27. # hauptstadt_dict["Deutschland"] = "Berlin" oder
  28. hauptstadt_dict = {"Russland": "Moskau",
  29. "Deutschland": "Berlin",
  30. "Ungarn": "Budapest",
  31. "Italien": "Rom",
  32. "Oesterreich": "Wien"}
  33.  
  34. b = spiel(hauptstadt_dict)
  35.  
  36. print "Gratuliere, du hast %i Punkte erreicht" % b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement