def 定義function
varalex()
# Result:
hello beauty
def varalex(usealex):
print 'hello beauty %s' %usealex
varalex('u look so beauty')
# Result:
hello beauty u look so beauty
def varalex(usealex):
for i in usealex:
print 'hello beauty %s' %i
varalex(['funny', 'ball', 'child', 'car', 'girl'])
# Result:
hello beauty funny
hello beauty ball
hello beauty child
hello beauty car
hello beauty girl
def varalex(usealex):
chralex = ''
for i in usealex:
chralex += 'hello beauty %s\n' %i
return chralex
alexvar = varalex(['funny', 'ball', 'child', 'car', 'girl'])
print alexvar
# Result:
hello beauty funny
hello beauty ball
hello beauty child
hello beauty car
hello beauty girl
留言列表