For Loops

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is output by the following code? for x in range (3, 18): print (x - 2, end=" ")

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

for range (15, 88): print (x) What is wrong with this program?

The first line should be for x in range(15, 88):

Which range function will generate a list of all even numbers between 12 and 84 inclusive?

range (12, 86, 2)

We use loops ________________________.

to repeat a section of code

Consider the following code: for i in range (x, y, z): print (i, end=" ") What values for variables x, y, and z will produce the output below? 26 24 22 20 18 16 14 12 10

x = 26 y = 8 z = -2

Consider the following code: for i in range (x, y): print (i, end=" ")

x = 5 y = 15


Kaugnay na mga set ng pag-aaral

bio 111 final (all unit quizzes)When a car burns gasoline, much of the energy is released in the form of heat. Which of the following best describes this process in relation to the first law of thermodynamics?

View Set

Unit 1- Foodborne Illnesses & Their Sources

View Set

Physical Geography Ch 2, Physical Geography- Chapter 2 Reading, GY 101 Chapter 2 (a)(b) Learnsmarts, Chapter 2, Geo2

View Set

open stax bones of the upper limb 8.2

View Set

Science 8: Chapter 4 → Section 2 Review

View Set