Advertisement
Guest User

Countries and Capitals

a guest
May 28th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import random
  2. b = -1
  3. picked = []
  4. countries=["Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "Guyana", "Paraguay", "Peru", "Surinam", "Uruguay", "Venezuela"]
  5. capitals=["Buenos Aires", "Sucre", "Brasilia", "Santiago", "Bogota", "Quito", "Georgetown", "Asuncion", "Lima", "Paramaribo", "Montevideo", "Caracas"]
  6. print("Let's play Guess the Capital!")
  7. def getNumber():
  8. b = random.randrange(0,11)
  9. def main():
  10. getNumber()
  11. while True:
  12. if b in picked:
  13. getNumber()
  14. else:
  15. break
  16. picked.append(b)
  17. print(countries[b])
  18. guess = input("Name the Capital:")
  19. if guess is capitals[b]:
  20. print("Correct!")
  21. else:
  22. print("Sorry, the answer was {0}.".format(capitals[b])
  23. while True:
  24. main()
  25. if input("Done?") is "yes":
  26. break
  27. elif len(b) >= 11:
  28. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement