#debugger example
print "This function creates a list."
def makelist():
a = [] # list
for i in range(1, 20):
a.append(i)
print "appending", i
print "now list", a
return a
def printlist(a):
for i in a:
print i,
b=makelist()
printlist(b)
#Dictionaries
#rock, paper, scissors game using dictionary
choice = raw_input("Enter s, r, or p: ")
results = {"s": "cut paper", "r": "crushes scissors", "p":
"covers rock"}
print choice, results[choice]
#
#
what is the approved version of the python for AL ICT?
ReplyDeleteThere is no version approved. Python 2.6 and 3.2 has differences.
ReplyDeleteExample : print statement python 2.6 is
print "hello"
in python 3.x its print ("hello") # with ()
every major version of python would have major changes. Therefore it's better to mention python version in answers.
Dear sir....
ReplyDeleteCould you send all python codings for a/l ict syllabus to my mail.
mathu2000@gmail.com