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

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 1 Review Spring 2004: What does it mean?

(Return to Sp2004 Midterm 1 Review)

Questions, answers, comments on answers, comments on questions?



def- declares that we are defining a function, and the text following the semi-colon will be the procedure.
for-executes some command for a sequence and each time there is a variable of a different element of the sequence.
for x in range(1,5)-this will do the command for each variable 1,2,3, and 4.
print-returns the specified entry.
print a- will return whatever was previously defined as a.

def is a command to define new functions, inside the parenthesis is the input
for sets up a loop that will apply the command to 1,2,3,4
print displays a readable representation of whatever follows it, print a will show up as an error, unless it is written as print "a", or if a is defined in the lines above
REMOVEDie Beth REMOVED

Don't think about print as "returning" anything (first response). Instead, it provides (as REMOVEDie said) a "readable representation." If you print picture, you'll get a "text readable representation" of the picture, NOT the actual picture. Mark Guzdial


Would it not also do the command on 5 in the range as well?

Nevermind on the comment above. I was being slow. HAHA.



Link to this Page