CSE 1010 Lecture Notes - Lecture 6: Boolean Expression
CSE 1010 verified notes
6/29View all
Document Summary
Else: alternate: activates if the previous expression fails. Check condition 1: if true, do consequent1 and skip the rest, if false, defer to the alternate, which is de ned by the else statement. An easy way to repeat a statement or group of statements a certain number of times. Loop is the noun, verb is iterate. Can contain any number of indented statements. Only form of the while loop, no else or elif. Statements are executed repeatedly as long as the condition is true. 4. return to step 1; test the condition. Loops and lists are frequently used together. Assignment statements are often used to increment the list. Assignment statement: evaluate the expression on the right hand side, store it in the variable on the left hand side. Whatever number n is, the function will increase it by 1: works with any variable (x,count,years)