Python beginners tried to code some energy drinks

I want to tell you that energy drinks are a heavy burden on your body ... I made it just for that. (Please forgive me for not writing the class and call in separate files)

import sys

class Monena:
    def __init__(self):
        self.physical = 50
        self.mental = 50
        self.destruction = False
        self.physical_recovery = 0
        self.mental_recovery = 0


    def status_check(self):
        print('Physical strength' + str(self.physical))
        print('Ki' + str(self.mental))

        if self.physical < 0 or self.mental < 0:
            self.destruction = True
            print('Out!!!')
            sys.exit()

    def work(self, physical_damage, mental_damage):
        print('Do you want to work today ...')
        self.physical = self.physical - physical_damage
        self.mental = self.mental - mental_damage
        self.physical_recovery = physical_damage
        self.mental_recovery = mental_damage

        if self.physical + self.mental < 50:
            self.monena()

        print('I've finally finished my work ...')
        self.status_check()
        self.sleep()


    def monena(self):
        boost = 100 - (self.physical + self.mental)
        self.mental = self.mental + boost
        self.physical_recovery = self.physical_recovery - int(boost / 2)
        self.mental_recovery = self.mental_recovery - int(boost / 2)

        print('Haha!')
        self.status_check()


    def sleep(self):
        print('Tired ... let's sleep ...')

        if self.physical + self.physical_recovery > 50:
            self.physical = 50
        else:
            self.physical = self.physical + self.physical_recovery

        if self.mental + self.mental_recovery > 50:
            self.mental = 50
        else:
            self.mental = self.mental + self.mental_recovery

        self.get_up()


    def get_up(self):
        print('Good morning ... Is it already morning ...')
        self.status_check()


monena = Monena()
monena.work(20, 20)
monena.work(30, 30)
monena.work(20, 20)
monena.work(30, 30)

Recommended Posts

Python beginners tried to code some energy drinks
python beginners tried to find out
Rewrite Python2 code to Python3 (2to3)
python beginners tried to predict the number of criminals
3 Reasons Beginners to Start Python
~ Tips for beginners to Python ③ ~
Convert python 3.x code to python 2.x
[Ipdb] Web development beginners tried to summarize debugging with Python
I tried to touch Python (installation)
I tried to solve the ant book beginner's edition with python
[Pandas] I tried to analyze sales data with Python [For beginners]
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried to refer to the fun rock-paper-scissors poi for beginners with Python
Answer to AtCoder Beginners Selection by Python3
[Episode 2] Beginners tried Numeron AI with python
[Episode 3] Beginners tried Numeron AI with python
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to get the authentication code of Qiita API with Python.
I tried to implement ADALINE in Python
[Episode 0] Beginners tried Numeron AI with python
[Episode 1] Beginners tried Numeron AI with python
I tried to implement PPO in Python
10 Python errors that are common to beginners
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
[Django-Extensions] Web development beginners tried to summarize Django-Extensions
I refactored "I tried to make Othello AI when programming beginners studied python"
Tips for Python beginners to use the Scikit-image example for themselves 6 Improve Python code
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 5/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part7 / 22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 4/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part3 / 22]
Machine learning beginners tried to make a horse racing prediction model with python
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 1/22]
Python beginners tried it in 3 days from OS installation to running Twitter API
I tried to refactor the code of Python beginner (junior high school student)
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 6/22]
I tried to execute Python code from .Net using Pythonnet (Hallo World edition)
Memo # 4 for Python beginners to read "Detailed Python Grammar"
Python code to convert region mesh code to latitude / longitude
The fastest way for beginners to master Python
Python script to convert latitude / longitude to mesh code
[Final story] Beginners tried Numeron AI with python
Memo # 3 for Python beginners to read "Detailed Python Grammar"
Personal notes to doc Python code in Sphinx
I tried to get CloudWatch data with Python
Memo # 1 for Python beginners to read "Detailed Python Grammar"
I tried to output LLVM IR with Python
Try to calculate RPN in Python (for beginners)
I tried to implement TOPIC MODEL in Python
I tried to automate sushi making with python
Memo # 2 for Python beginners to read "Detailed Python Grammar"
List of Python code to move and remember
Memo # 7 for Python beginners to read "Detailed Python Grammar"
I want to make C ++ code from Python code!
I tried to implement selection sort in python
Introduction to Programming (Python) TA Tendency for beginners
Memo # 6 for Python beginners to read "Detailed Python Grammar"
How to make Python faster for beginners [numpy]