标签:
本文主要介绍了函数的定义及如何调用,具体如下代码:
代码:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def p():
while True:
time1=raw_input(‘print input now time:‘)
if time1>‘0‘ and time1<‘12‘:
print ‘Good morning!‘
elif time1>=‘12‘ and time1<‘18‘:
print ‘Good afternoon!‘
elif time1>=‘18‘ and time1<‘24‘:
print ‘Good evening!‘
else:
break
print ‘OVER!‘
p()
运行结果:
标签:
原文地址:http://www.cnblogs.com/pythonlh/p/5725001.html