Linguistic Gaming with Python

Python Practice 5

In this exercise, you practice with tuples and do more indexing and slicing.

Exercise 1: Expand your "Battle" program (from Python Practice 3) so that the user can chose from a list of heroes. Use a tuple to code up the hero names. Add in another tuple which lists the weapons inventory that is available for the game. Tell the user what is in the inventory and allow the user to choose a weapon from the inventory.

Exercise 2: Write a program that defines two tuples. One contains a bunch of nouns, the other contains a bunch of adjectives. Allow the user to provide you with either an adjective or a noun. If the user provides an adjective, pick a noun at random from the nouns tuple and produce a compound noun. For example, the user inputs "rot", and the program randomly chooses "kopf", the output should be "rotkopf" (German is better at compounding, so it is better to do this with German if you know German...). If the user provides a noun, then pick an adjective at random from the adjectives tuple and produce a compound noun.

Exercise 3: Take Dawson's Word Jumble Program and modify it in the following way.

  1. The program should work for a language of your choice other than English. It should let the player guess words in this language (tell the user which language the words are in).
  2. If the user wants a hint, the program will give them one. For example, it could tell the user what letter the word begins with or ends with.
  3. Add a scoring system that keeps track of how many hints the player took and deducts points for each hint. The players should be awarded more points if they use less or no hints.

Please hand in the programs for the Exercises to aikaterini-lida at uni konstanz by Friday the 28th of November by 11 am.