CGSC 1005 Lecture Notes - Lecture 5: Boolean Expression

35 views2 pages

Document Summary

Iteration: repeated execution of one or more statements in a program. Assume there are only 4 expenses what"s the issue with the following code: It is very repeatitive, easier to use a loop. Statement is one or more lines of python code: note the indent before statement(s) It executes the statements inside the loop as long as the condition remains true. Changing values of the variables within the loop. When controlled by a variable, the loop must change that variable otherwise it will be endless loop. If condition is true, it executes each statement inside while block. If statement is false, it moves to code after while block. The goal of a while loop is to repeat the code inside of the block. We can control how many times the while code is executed by: the condition, by eventually making it evaluate to false, the break statement, or a combination of both.

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