Measure BMI index in Python.

I made an app program that measures BMI index by groping.

If there are any unfilled parts (especially height and weight), an error will occur.

That's why it's still incomplete, I'm sorry.

# coding: utf-8

class bodyData:
    uName = ''
    uSex = 0
    uAge = 0
    uHeight = 0
    uWeight = 0
    uBmi = 0

    def __init__(self, uName = 'Nakamura', uSex = 0, uAge = 26):
        self.uName = uName
        self.uSex = uSex
        self.uAge = uAge

        print('Name from this: ' + str(self.uName))
        #'sex: ' + str(self.uSex))
        if (self.uSex == '0'):
            print('sex:male')
        elif (uSex == '1'):
            print('sex:Female')
        else:
            print('sex:I do not know!!')
        print('age: ' + str(self.uAge) + '\n' +
        'Measures the BMI index of.')

    def set_bodyData(self, uHeight, uWeight):
        self.uHeight = uHeight
        self.uWeight = uWeight

    def result_bodyData(self, uBmi):
        self.uBmi = uBmi

        print('We will inform you of the result.' + '\n' +
        'Full name: ' + (self.uName))
        if (self.uSex == '0'):
            print('sex:male')
        elif (self.uSex == '1'):
            print('sex:Female')
        else:
            print('I don't know my gender!!')
        print('age: ' + str(self.uAge) + '\n' +
        'height: ' + str(self.uHeight) + 'cm' + '\n' +
        'body weight: ' + str(self.uWeight) + 'kg' + '\n' +
        'The BMI index of the above persons is...' + '\n' +
        '\n' +
        str(round(self.uBmi,1)) + '\n')

    def result_Bmi (self):
        if (self.uBmi < 18.5):
            print('I'm too thin.' + '\n' +
            'Let's get fat.')
        elif (18.5 < self.uBmi < 25):
            print('It is a proper weight.' + '\n' +
            'Let's keep it as it is.')
        elif (25 < self.uBmi < 30):
            print('I'm starting to gain weight.' + '\n' +
            'Don't worry.')
        elif (30 < self.uBmi < 35):
            print('I'm fat.' + '\n' +
            'Let's be aware.')
        elif (35 < self.uBmi < 40):
            print('Don't you notice?' + '\n' +
            'You are fat')
        elif (self.uBmi >= 40):
            print('There is a problem.')
        else:
            print('The input is incorrect somewhere.' + '\n' +
            'Sorry.')

uName = input('Please enter your name.' + '\n' +
'=> ')
uSex = input('Please enter your gender. 0=Male, 1=Female' + '\n' +
'=> ')
uAge = input('Please enter your age.' + '\n' +
'=> ')

bd = bodyData(uName, uSex, uAge)

uHeight = input('Please enter your height in cm.' + '\n' +
'=> ')
uWeight = input('Please enter your weight in kg.' + '\n' +
'=> ')

bd.set_bodyData(uHeight, uWeight)

uBmi = int(uWeight) / ((int(uHeight) / 100) ** 2)

bd.result_bodyData(uBmi)

bd.result_Bmi()

that's all.

Recommended Posts

Measure BMI index in Python.
Measure function execution time in Python
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Pre-process the index in Python using Solr's ScriptUpdateProcessor
Daily AtCoder # 36 in Python
Clustering text in Python
Implement Enigma in python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Edit fonts in Python
Singleton pattern in Python
File operations in Python
Read DXF in python
Daily AtCoder # 53 in Python
Key input in Python
Use config.ini in Python
Solve ABC168D in Python
Daily AtCoder # 7 in Python
LU decomposition in Python
One liner in Python