Computer Science 1026A/B Chapter Notes - Chapter 4: Saber Of London, Sentinel-2, Empty String

119 views5 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Executes instructions repeatedly until goal is reached. Flow of execution loops again to the point where condition is tested. Keeps getting tested until goal is reached. While balance < target: while statement. Interest =balance * rate / 100 body of while statement. Aka while means as long as condition is true. Infinite loop if condition never becomes false: kill a hanging system by ctrl + c, don"t forget to update variable in the while statement. Update variable inside loop: something inside the loop should change one of the variables used in the test. Count controlled bc controlled by counter: counter = 1, while counter <= 10 , print(counter, counter = counter + 1. Event-controlled bc executes until an event occurs: while balance < target , year = year + 1, balance = balance + interest interest = balance * rate / 100. Definite if you know how many iterations it takes to reach goal.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents