CPSC120A
Fundamentals of Computer Science I

Lab 19

Strings

Use the command line to create a new directory called lab19 in your labs directory. Make sure all of the .py files that you create for this activity are in that directory.

Random Word

Download the words.py Python module. The module currently only contains the words_string variable. Add a function called get_random_word() to the top of the file. The function should have no parameters and should return a random word from the word string.

To get a random word, generate an int for a random character in the word string. Then use a while loops to find the space characters before and after the random character. Finally, use a slice to return the word between the two space characters. Be sure to test the module before proceeding.

Centered Word

Create a Python program in a file called random_word.py. The program should use Pygame to draw a random word that is centered both vertically and horizontally in the window. Use the words module you created in the previous excercise to generate the random word. Be sure to test the program before proceeding.

Design Document

Create a design document for your assignment 6 game, on paper. The design document should include a diagram of what the game will look like. It should also have a text description of how to play the game including how to win or lose.

Please give me your design document before beginning work on the assignment.

Submission

Please show your source code and run your programs for the instructor or lab assistant. Only programs that have perfect style and flawless functionality will be accepted as complete.