Advertisement
biswasrohit20

hei 2

Mar 24th, 2021
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. feet = input("Enter the height in feet: ") # firstly taking the input in feet
  2. if feet == "": # then checking if it's blank, then, will exit the code.
  3. exit()
  4. feet = int(feet)
  5.  
  6. inch = input("Enter the height in inch: ") # Same thing for inch
  7. if inch == "":
  8. exit()
  9. inch = int(inch)
  10.  
  11. total = (feet*12) + inch # changing the feet into inch and hence getting the total height in inch.
  12.  
  13. if total >= 96: # in this line I am checking if the height is more than 96, and hence saying that the person is tall
  14. print("The person is really tall!")
  15.  
  16. total_cm = total*2.54 # converting the total height in inch to centimeter
  17. m_and_cm = round(total_cm/100,2) # then converting in meter and rounding up to two decimal place
  18. print(f'{feet} feets {inch} inches are equivalent to {m_and_cm} meters') # finally printing the solution.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement