Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 2 Review Fall 2005: Tracing the printing #2


does it print: I, you, walrus, 1

What does len(c) do? -Blake O'Hare

does it print this:
I
you
you
you
you
you
walrus
5

len(c): the length of c, in this case = 6?
Yes. It tells you how long a string is

what is len(c), is it some sort of repeat code? how do we know it's six in this case?????

will it print
I
you
walrus
1

why is "you" repeated 5x and how do we know that the value is 5? i'm confused
how many values are there in list1? - Albert d'Heurle

is it :
l,r,u,s,walrus,4?
No. -Blake O'Hare

is it,
I
you
you
you
you
you
walrus
5
Yes. -Blake O'Hare

Yay!!!!! :-D

since value=0 how come value+1 =5 instead of 1?
how many times do we add 1 to value? -Albert d'Heurle

because it goes thru the for loop 5 times, each time it adds 1 to the value.

So range(1,6) really means 1-5? Then why have 6?
the range function is exclusive for the second number. the second number is basically the stopping condition. it executes for 1, 2, 3, 4, and 5, and then it says "are we at 6? yes, don't execute the loop and move to the next thing" -poof #10

list one is 1-5 becuase we do not include 6, but for value don't we add back a one so it will 6.



Link to this Page