python health & love game(1)

Body_Health.py

#!/usr/bin/python
#_*_coding:utf-8_*_
#身体健康模块

#询问平时最常参加的运动            
def chose_sport(Chose_Sport):
    Sports_Notes = open('/home/neal/Desktop/Psychological_Game/sports_notes.txt')
    if Chose_Sport == 'No_Sport':
        print "YOU ARE SO LAZZY !!!And here's some notes that may help ehance you body level:"
        print Sports_Notes.read()
        Sports_Notes.close()
    else:
        sport_length()  
    
#询问每周运动时长的函数        
def sport_length():
    Sports_Notes_2 = open('/home/neal/Desktop/Psychological_Game/sports_notes_2.txt')
    print "Ok,good.And how long are you sporting every week in average?"
    Length = int(raw_input('> '))
    print "Here's some advices which may be useful for your regular sport's training:\n",Sports_Notes_2.read()
    Sports_Notes_2.close()
    
#执行函数
def start():
    print """which sport are you like best:
    Jogging, Ball, Indoor_Fitness, Swimming, Cycling, No_Sport or Other ...
    """
    Chose_Sport = raw_input('> ')
    #模块中的类中的一个函数调用本类中的另外一个函数需要在函数前加self.
    chose_sport(Chose_Sport)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容