Python Reading
- Read the chapter entitled More About Iteration.
- for loop
- Know how to use range
- Know how to iterate over a string (e.g. "Belgrade High") or a list (e.g. [1, "Potato", 2, "Potato"])
- while loop
- Know how to nest one loop inside of another
- Write a Python program that generates a random number between 1 and 10. The program should repeatedly ask the user to guess what the number is until the user guesses correctly. When the user guesses correctly, the program should print a message that shows how many tries it took. For example, the message might be Congratulations! That took 6 guesses.
- Write a Python program that asks the user to enter two integers: one for the number of rows and one for the number of columns. The program should then produce a text-based drawing where each position in the drawing is randomly determined with equal probability to be either a "*" or a "-". For example, with 4 rows and 6 columns, the drawing might look like this:
- Python has two keywords that are relevant to loops: continue and break. Determine what they do by experimenting with loop.py. Note: Try to avoid using these two Python constructs. Typically, there is a better way to solve the problem.