ECS 10 Lecture 7: Loops

31 views3 pages

Document Summary

I. e if x > 4 it will run the code. If the condition is met you go into the while loop. once it gets to the bottom of the code it goes back to check the condition. it keeps running the loop until the condition becomes false. Indentation is important to the loop, just like if and elif statements. A common practice during while loops is to update a variable after. This loop will extract a copy of the iterable to run the code on. Iterating through strings you go through each letter of the string. A range between start and stop counting by step. Start is included but stop is not. You can check to see if a value is in a range. You can iterate over the values within the range. You must assess the situation to figure out what type of loop you are going to need. different loops are needed for different situations.

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