The readings for Tuesday, September 13 are:
Automate the Boring Stuff with Python
Once you have completed these readings, please answer the following questions:
What is the difference between a while loop and a for loop? When would you use one over the other?
Given the following Python code, identify any errors, explain what is wrong, and then fix the problems.
# Print the sum of the integers 0 through 9 using a while loop
n = 0
total = 0
while n < 9:
total + n
print total
Hint: Trace through the code using the Online Python Tutor.
If your notebook ends up hanging for whatever reason, then try to reset it by
going to Kernel
and then Interrupt
. If that fails, try Kernel
and then
Restart
. If that also fails, then you will need to shutdown Jupyter and
restart it.
If you have any questions, comments, or concerns regarding the course, please provide your feedback here.
To submit your response, please edit the reading03/README.md file in your GitLab repository.