Question: Python Questions 1. In the following code, what is the iteration variable? there is none, cnt or country cnt = 0 for country in [Canada,Mexico,

Python Questions

1.

In the following code, what is the iteration variable? there is none, cnt or country

cnt = 0 for country in ["Canada","Mexico", "United States"]: cnt = cnt + 1 print(cnt)

2.

This code should repeatedly print whatever the user enters, until the user enters "done" (no quotes). It should *not* print the word "done" though.

while True: # line 1 w = input("> ") # line 2 print(w) # line 3

To make it work correctly we need to add the following code:

if w == "done": break

Where should we add this code?

before line 1

after line 1

after line 2

after line 3

3. Fill in the blank in this code so it prints the sequence 10, 5, 0. Use the fewest spaces that makes a legal Python statement.

y = 10

while y >= 0:

print(y)

___________

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!