while True:
def std_weight(height,gender):
ifgender == "Men":
return height * height * 22
elifgender == "Woman":
return height * height * 21
else:
print("You have entered it incorrectly.")
break
print("Please enter the key (excluding cm): ")
height = int(input())
print("Please select a gender". Male or female : ")
gender = str(input())
weight = round(std_weight(height / 100, gender), 2)
print("The standard weight of height {0} cm {1} is {2} kg."format(height,gender,weight))
I was studying while watching YouTube, and I have a question. If I put a different value between the key input part and the gender part, I want to keep repeating the phrase, what should I do?
python
l = ["Boy". "Woman"]
while True:
gender = str(input())
if gender in l:
break
In the case of gender, it is relatively simple in the above way.
But the key depends on how much other value you're talking about.
Do I just need to get a number? Should we be within the range of what we think is height?
Of course, either way, you just have to filter it well with conditional sentences.
Basically, it's possible in a gender-like way, so think about it Haha
824 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 GDB gets version error when attempting to debug with the Presense SDK (IDE)
566 PHP ssh2_scp_send fails to send files as intended
572 Uncaught (inpromise) Error on Electron: An object could not be cloned
558 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.