Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
charlo668 committed Aug 5, 2024
1 parent fd41a4d commit 350130e
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
11 changes: 11 additions & 0 deletions challenge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#challenge
#checking if a number is odd or even


print("welcome to the number check where we check if a number is odd or even")
number=int(input("enter your number: "))

if number%2==0:
print("the number is even")
else:
print("the number is odd")
20 changes: 20 additions & 0 deletions challenge2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#BMI CALCULATOR

print("welcome to our bmi calculator")

height=float(input('enter your height in cm: '))
weight= float(input("enter your weight in kg: "))

bmi= round(weight/(height/100)**2)

print(bmi)
if bmi<18.5:
print("you are under weight")
elif bmi>=18.8 and bmi <25:
print("you have a normal weight")
elif bmi >=25 and bmi<30:
print("you are over weight")
elif bmi>=30 and bmi<35:
print("you are obese")
else:
print("you are clinically obese")
14 changes: 14 additions & 0 deletions challenge3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# LEAP YEAR CHALLENGE

print("welcome again here we check whether the given year is a leap year or not")

year=int(input("enter your year of choice"))

if year%4==0:
if year%400==0:
print("this is a leap year")
else:
print("not a leap year")
print(f"so the year {year} is a leap year")
else:
print('not a leap year')
10 changes: 10 additions & 0 deletions ifelse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
print('welcome to the rolllercoster')
height=int(input("enter your height in cm: "))

if height>=120:
print("you can ride the rollercoster!")
else:
print("sorry you have to grow taller to ride here!")



30 changes: 30 additions & 0 deletions multiple if conditions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#multiple if conditions
print("welcome agin to our rolllercoster")
height=int(input("enter your height in cm: "))
bill=0
if height>120:
print("you can ride the roller coster")

age=int(input("enter your age"))
if age>18:
bill=20
print("adult ticket: $20")
elif age<12:
bill=5
print("children ticket: $5")
elif age>=12 and age<=18:
bill=7
print("youth tickets: $7")

wantphoto=input("do ypu want a photo taken ?: Y or N: ")
if wantphoto.lower()=="y":
bill+=3

if wantphoto.lower()=='n':
bill+=0
print("thank you and enjoy your ride")
print(f"your total bill is {bill}")

else:
print("you will have to grow taller to ride")

16 changes: 16 additions & 0 deletions nestedifstatements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
print("welcome agin to our rolllercoster")
height=int(input("enter your height in cm: "))

if height>120:
print("you can ride the roller coster")

age=int(input("enter your age"))
if age>18:
print("you will have to pay adult price $20")
elif age<12:
print("please pay $5")
elif age>=12 and age<=18:
print("please pay $7")
else:
print("you will have to grow taller to ride")

0 comments on commit 350130e

Please sign in to comment.