您的位置:首页 > 编程语言 > Python开发

Python入门的36个例子——17 Return

2009-09-12 01:32 423 查看
# 017
def lifeIsAMirror():
string = raw_input()
if string == 'I love you!':
return 'I love you, too!'
elif string == 'Fuck you!':
return ''
else:
return
# end of def
string = lifeIsAMirror()
if len(string) == 0:
print 'You have nothing.'
else:
print string
# end of if


output:

1

2

3

4

5

6

>>>

Fuck you!

You have nothing.

>>>

I love you!

I love you, too!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: