You are on page 1of 3

In [2]: print("Welcome to the rollercoster!

")
height = int(input("What is your height in cm? "))
if height >=120:
print("You can ride the rollercoster! ")
else:
print("Sorry, you have to grow taller before you can ride.")

Welcome to the rollercoster!


What is your height in cm? 119
Sorry, you have to grow taller before you can ride.

In [4]: number = int(input("Which number do you want to check? "))


if number %2 ==0:
print("This is even number.")
else:
print("This is odd number.")

Which number do you want to check? 77


This is odd number.

In [6]: number = int(input("Which number do you want to check? "))


if number %7 ==0:
print("This is divisable by seven.")
else:
print("This is not divisable by seven.")

Which number do you want to check? 78


This is not divisable by seven.

In [10]: print("Welcome to the rollercoster! ")


height = int(input("What is your height in cm? "))
if height >=120:
print("You can ride the rollercoster! ")
age = int(input("What is your age? "))
if age <=18:
print("Please pay 7 $")
else:
print("Please pay 18 $")
sex = str(input("What is your sex? "))
if sex == female:
print("You have discount of 7% ")
else:
print("You have discount of 4 %")
else:
print("Sorry, you have to grow taller before you can ride.")

Welcome to the rollercoster!


What is your height in cm? 134
You can ride the rollercoster!
What is your age? 14
Please pay 7 $
What is your sex? female
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [10], in <cell line: 3>()
9 print("Please pay 18 $")
10 sex = str(input("What is your sex? "))
---> 11 if sex == female:
12 print("You have discount of 7% ")
13 else:

NameError: name 'female' is not defined


In [11]: print("Welcome to the rollercoster! ")
height = int(input("What is your height in cm? "))
if height >=120:
print("You can ride the rollercoster! ")
age = int(input("What is your age? "))
if age <=18:
print("Please pay 7 $")
else:
print("Please pay 18 $")
sex = str(input("What is your sex? "))
if sex == 1:
print("You have discount of 4% ")
else:
print("You have discount of 7 %")
else:
print("Sorry, you have to grow taller before you can ride.")

Welcome to the rollercoster!


What is your height in cm? 175
You can ride the rollercoster!
What is your age? 14
Please pay 7 $
What is your sex? 1
You have discount of 7 %

In [35]: print("Welcome to the rollercoster! ")


height = int(input("What is your height in cm? "))
if height >=120:
print("You can ride the rollercoster! ")
age = int(input("What is your age? "))
if age <12:
print("Please pay 5 $")
elif age <=18:
print("Please pay 7 $")
elif age < 18:
print("Please pay 12 $")
else:
print("Sorry, you have to grow taller before you can ride.")

Welcome to the rollercoster!


What is your height in cm? 175
You can ride the rollercoster!
What is your age? 29

In [18]: print("Welcome to the rollercoster! ")


height = int(input("What is your height in cm? "))
if height >=120:
print("You can ride the rollercoster! ")
age = int(input("What is your age? "))
if age <12:
print("Please pay 5 $")
elif age <=18:
print("Please pay 7 $")
else:
print("Please pay 12 $")
else:
print("Sorry, you have to grow taller before you can ride.")

Welcome to the rollercoster!


What is your height in cm? 175
You can ride the rollercoster!
What is your age? 29
Please pay 12 $
In [28]: height = float(input("Please enter your height in m . "))
weight = float(input("Pleas enter your weight in kg. "))
bmi = round(weight / height **2)
if bmi < 18.5:
print(f"Your bmi is {bmi}, you are under weight ! ")
elif bmi<25:
print(f"Your bmi is {bmi}, you have a normal weight !")
elif bmi<35:
print(f"Your bmi is {bmi}, you are obese !")
else:
print(f"Your bmi is {bmi}, you are clinially obese.")

Please enter your height in m . 1.75


Pleas enter your weight in kg. 75
Your bmi is 24, you have a normal weight !

In [45]: year = int(input("Which year do you want to check: "))


if year %4 ==0:
if year %100 ==0:
if year % 400:
print("leap year")
else:
print("Not leap year.")
else:
print("Leap year")
else:
print("Not leap year.")

Which year do you want to check: 2100


leap year

In [ ]:

You might also like