I&C SCI 31 Lecture Notes - Lecture 6: Ejection Seat, Toyota Electronic Modulated Suspension
Document Summary
For item in ducks: print (item[0], is a hot duck. ") Variable gets the value of the first item in sequence. Execute the body of the loop with variable having that value. Then go on to the next statement after the for. Variable gets the value of the second item in sequence. Execute the body with variable having that value. Syntax: same as above (where sequence is a range of numbers) While-loop: for indefinite repetition, until something becomes true or while something remains true. One special pattern with while loops: n-and-a-half-times loop while true: First part of body if boolean-expression: break [or return] Next statement def handle_commands(): pass #a program stub, good way of bypassing the function and you should do this so you can test your code without any definition errors. For item in bsi loop only accesses tems in the object bsi but cannot change anything or carry out actions where memory is modified.