码迷,mamicode.com
首页 > 其他好文 > 详细

def函数的定义及调用

时间:2016-08-01 12:06:16      阅读:510      评论:0      收藏:0      [点我收藏+]

标签:

 本文主要介绍了函数的定义及如何调用,具体如下代码:

代码:

#!/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()

运行结果:

技术分享

 

def函数的定义及调用

标签:

原文地址:http://www.cnblogs.com/pythonlh/p/5725001.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!