python health & love game(1)

作者: faraway_com | 来源:发表于2017-06-13 17:19 被阅读0次

    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)
    
    

    相关文章

      网友评论

        本文标题:python health & love game(1)

        本文链接:https://www.haomeiwen.com/subject/vwtjqxtx.html