Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
269 views

Programming For Everybody (Getting Started With Python) - Home - Coursera - 5 PDF

This document contains a 10 question quiz about Python loops, break, continue, and other control flow statements from Chapter 5 of the Coursera course "Programming for Everybody (Getting Started with Python)". The quiz covers topics like for loops, while loops, the break and continue statements, iteration variables, and using control flow statements to iterate through lists and calculate totals. All 10 questions are multiple choice and provide hints for trick questions.

Uploaded by

DeezNuts
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
269 views

Programming For Everybody (Getting Started With Python) - Home - Coursera - 5 PDF

This document contains a 10 question quiz about Python loops, break, continue, and other control flow statements from Chapter 5 of the Coursera course "Programming for Everybody (Getting Started with Python)". The quiz covers topics like for loops, while loops, the break and continue statements, iteration variables, and using control flow statements to iterate through lists and calculate totals. All 10 questions are multiple choice and provide hints for trick questions.

Uploaded by

DeezNuts
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

03/05/2019 Programming for Everybody (Getting Started with Python) - Home | Coursera

Chapter 5 10/10 points (100%)


Quiz, 10 questions

Congratulations! You passed! Next Item

1/1
 point

1. 
What is wrong with this Python loop:

1 n = 5
2 while n > 0 :
3 print(n)
4 print('All done')

1/1
 point

2. 
What does the break statement do?

1/1
 point

3. 
What does the continue statement do?

1/1
 point

4. 

https://www.coursera.org/learn/python/exam/HtpHM/chapter-5 1/3
03/05/2019 Programming for Everybody (Getting Started with Python) - Home | Coursera

What does the following Python program print out?


Chapter 5 10/10 points (100%)
Quiz, 10 questions
1 tot = 0
2 for i in [5, 4, 3, 2, 1] :
3 tot = tot + 1
4 print(tot)

1/1
 point

5. 
What is the iteration variable in the following Python code:

1 friends = ['Joseph', 'Glenn', 'Sally']


2 for friend in friends :
3 print('Happy New Year:', friend)
4 print('Done!')

1/1
 point

6. 
What is a good description of the following bit of Python code?

1 zork = 0
2 for thing in [9, 41, 12, 3, 74, 15] :
3 zork = zork + thing
4 print('After', zork)

1/1
 point

7. 
What will the following code print out?

1 smallest_so_far = -1
2 for the_num in [9, 41, 12, 3, 74, 15] :
3 if the_num < smallest_so_far :
4 smallest_so_far = the_num
5 print(smallest_so_far)

Hint: This is a trick question and most would say this code has a bug - so read carefully

1/1
 point

8. 

https://www.coursera.org/learn/python/exam/HtpHM/chapter-5 2/3
03/05/2019 Programming for Everybody (Getting Started with Python) - Home | Coursera

What is a good statement to describe the is operator as used in the following if statement:
Chapter 5 10/10 points (100%)
Quiz, 10 questions
1 if smallest is None :
2 smallest = value

1/1
 point

9. 
Which reserved word indicates the start of an "inde nite" loop in Python?

1/1
 point

10. 
How many times will the body of the following loop be executed?

1 n = 0
2 while n > 0 :
3 print('Lather')
4 print('Rinse')
5 print('Dry off!')

https://www.coursera.org/learn/python/exam/HtpHM/chapter-5 3/3

You might also like