Question: Now, explore using for and while loops and breaks. Here are some things to try, and questions to ask - each of which you should

Now, explore using for and while loops and breaks.
Here are some things to try, and questions to ask - each of which you should explore in code.
What happens if you use 'break' all by itself?
What are some different ways to loop through a list? tuple?
Write these combinations:
a for loop with a break, a for loop with a continue
a while loop with a break, a while loop with a continue
Write some loops that loop across lists:
Write a loop that loops across, and prints out, all the elements of a list
Write a loop that loops across, and prints out, every second element of a list
Write a loop that loops across, and prints out, every element of a list in reverse order
Write a loop that loops across, and prints out, the first half of a list
Write a loop with a conditional inside it.
Can you have loops inside loops? If you think so, try and write a nested loop.
Reminder: you can add as many cells as you'd like to test these out! (Please use python)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!