list_1 = [3, 9, 12, 15, 18]
list_2 = [2, 4, 8, 16, 32]
for a, b in zip(list_1, list_2):
if a>b:
print "a is bigger"
elif b>a:
print "b is bigger"
else:
print "a is equal to b"
2014年7月8日火曜日
python: enumurate
choices = ['soccer', 'tennis', 'basketball', 'balleyball']
print 'Your choices are:'
for index, item in enumerate(choices):
print index+1, item
print 'Your choices are:'
for index, item in enumerate(choices):
print index+1, item
2014年7月7日月曜日
2014年7月2日水曜日
python function
def square_cal(length,width):
return length*width
def square(length,width):
if length==width:
return square_cal(length,width)
else:
return "Not square"
return length*width
def square(length,width):
if length==width:
return square_cal(length,width)
else:
return "Not square"
登録:
投稿 (Atom)