Computer Science 1026A/B Lecture 1: Chapter 1
terubarenuka and 39895 others unlocked
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents
Document Summary
: repeatedly execute instructions while a condition is true. Example balance = 10. 0 target = 100. 0 year = 0 rate = 0. 025 while balance < target : year = year + 1 interest = balance * rate/100 balance = balance + interest. : a task is executed a task a definite # of times. : as long as the conditions is true the loop will continue, if untrue, the statement block is skipped. Example 1 counter = 1 # initialize the counter while counter <= 10: #check the counter print(counter) counter = counter + 1 #update the counter.