-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (35 loc) · 2.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# /*
# * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# * *
# * * Copyright (C) 2023 Fatih Tün - All Rights Reserved
# * *
# * * Unauthorized copying of this file, via any medium is strictly prohibited
# * *
# * * Proprietary and confidental.
# * *
# * * Written by Fatih TÜN <[email protected]>, April 2023
# */
# This program takes in a person's sex and weight as inputs and categorizes the weight as normal, below average, or above average based on the provided criteria.
sex = input("Enter sex (m/f): ") # Ask the user to input their sex (either 'm' or 'f') and store the input in the variable 'sex'.
weight = float(input("Enter weight in kg: ")) # Ask the user to input their weight in kilograms and store the input as a floating-point number in the variable 'weight'.
# Check the sex of the person and determine the appropriate weight category based on the criteria provided.
if sex == "f": # If the sex is female:
if weight <= 50: # If the weight is less than or equal to 50 kg:
print("Weight is thin") # Print "Weight is thin".
elif weight <= 70: # Otherwise, if the weight is less than or equal to 70 kg:
print("Weight is normal") # Print "Weight is normal".
elif weight <= 100: # Otherwise, if the weight is less than or equal to 100 kg:
print("Weight is heavy") # Print "Weight is heavy".
else: # Otherwise (if the weight is greater than 100 kg):
print("Weight is obese") # Print "Weight is obese".
elif sex == "m": # Otherwise (if the sex is male):
if weight <= 60: # If the weight is less than or equal to 60 kg:
print("Weight is thin") # Print "Weight is thin".
elif weight <= 80: # Otherwise, if the weight is less than or equal to 80 kg:
print("Weight is normal") # Print "Weight is normal".
elif weight <= 100: # Otherwise, if the weight is less than or equal to 100 kg:
print("Weight is heavy") # Print "Weight is heavy".
else: # Otherwise (if the weight is greater than 100 kg):
print("Weight is obese") # Print "Weight is obese".
else: # Otherwise (if an invalid sex is entered):
print("Invalid sex entered.") # Print "Invalid sex entered.".