Results of a dice game |
Wednesday, June 5, 2013
GIS Programming, Lab 4: Python Fundamentals - Part 2
This weeks lab was a little more difficult. We focused on modules, conditional statements, loops (for and while) and learned how to leave comments and instructions in a script. We were given a partial script (with numerous errors) and we had to figure out what was wrong, correct it and then write a loop.
The result of the corrected script was a dice game. It took into account the length of the players names, a random "die roll" and that determined whether the players won, lost or tied. It ran through all of the players, giving them each a turn. At the end we had to create a loop that printed the numbers 0-5.
Labels:
GIS Programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment