Tuesday, September 27, 2011

LPTHW Exercise 36

In this exercise I created a simple text based game. This game consists of countries and capitals. A user is flown to a country, where the immigration officer asks them the name of the capital. If you answer correctly, you get a point, if you answer incorrectly you do not get any points. The game quits when the user has correctly guessed the capitals of all the countries, or if they type CTRL-C.

Stuff I learned:
  • How to generate a random number in Python
  • How to get the length of a list
  • We can nest lists within lists
  • A function can return multiple values
  • The main function has a really strange syntax
  • The ++ increment operator is not supported in Python
  • Making a simple game is fun




No comments:

Post a Comment