0% found this document useful (0 votes)
24 views2 pages

Int Input

The document contains several code examples that demonstrate taking user input, performing calculations, and conditionally printing outputs. The examples include converting between Fahrenheit and Celsius, calculating time in days/hours/minutes from minutes, computing Euclidean distance between coordinates, checking for odd/even numbers, determining if a year is a leap year, and calculating a recommended weight based on age, sex, and training duration.

Uploaded by

mcyaiza15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Int Input

The document contains several code examples that demonstrate taking user input, performing calculations, and conditionally printing outputs. The examples include converting between Fahrenheit and Celsius, calculating time in days/hours/minutes from minutes, computing Euclidean distance between coordinates, checking for odd/even numbers, determining if a year is a leap year, and calculating a recommended weight based on age, sex, and training duration.

Uploaded by

mcyaiza15
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

0.

1
temperature = int(input("Enter the temperature in Fahrenheit:"))
Celsius = ((temperature-32)*(5/9))

print(f"{Celsius}ºC")

0.3
minutes = int(input("Enter the number of minutes:"))
days = minutes//(24*60)
hours = (minutes%(24*60))//60
minutes = (minutes%(24*60))%60

print(f"{days}d,{hours}h,{minutes}m")

0.4
import math
x1 = float(input("Enter coordinate x1:"))
y1 = float(input("Enter coordinate y1:"))
x2 = float(input("Enter coordinate x2:"))
y2 = float(input("Enter coordinate y2:"))

distance = math.sqrt((x2-x1)**2 + (y2-y1)**2)


print("The Euclidean distance is:", distance)

1.10
num1 = int(input("Number 1:"))
num2 = int(input("Number 2:"))
num3 = int(input("Number 3:"))
num4 = int(input("Number 4:"))
x=0
if num1%2 == 1:
x += 1
if num2%2 == 1:
x += 1
if num3%2 == 1:
x += 1
if num4%2 == 1:
x += 1
if x >= 2:
print("At least two of the numbers are odd.")
else:
print("Less than two numbers are odd.")

1.11
year = int(input("Introduce year:"))

if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):


print("Leap Year")
else:
print("Not Leap Year")

BLO-1
age = int(input("What's your age?:"))
sex = input("What's your sex? (Female/Male):")
training = int(input("How many months have you been training?:"))

minweight = 20

if age > 65:


maxweight = 60
else:
maxweight = 80
if sex == "Male":
recommended_weight = minweight + 2*training
elif sex == "Female":
recommended_weight = minweight + training
else:
print("Invalid input, enter Female or Male")
recommended_weight = Error

print("Your recommended weight is:",recommended_weight)

You might also like