Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views3 pages

IFELSE

The document provides two programming tasks involving conditional statements. The first task calculates the Body Mass Index (BMI) based on weight and height, categorizing individuals as Under Weight, Normal Weight, Over Weight, or OBESE. The second task calculates the final bill amount in a supermarket based on discount thresholds for different bill amounts.

Uploaded by

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

IFELSE

The document provides two programming tasks involving conditional statements. The first task calculates the Body Mass Index (BMI) based on weight and height, categorizing individuals as Under Weight, Normal Weight, Over Weight, or OBESE. The second task calculates the final bill amount in a supermarket based on discount thresholds for different bill amounts.

Uploaded by

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

IF Else

Q1- The body mass index (BMI) is computed by taking the individual's
weight (mass) in kilograms and dividing it by the square of their height in
meters. a. Show the category of the person depending on BMI value

(Note convert Height value in meter)

Formula- meters=feet×0.3048

INPUT

w=int(input("Enter your Weight:"))

h=float(input("Enter your height:"))

h1=h*0.3048

print("Converted value in meeter:",h1)

bmi=w/(h1*h1)

if bmi<18.5:

print("Under Weight")

elif bmi>=18.5 and bmi<=24.9:

print("Normal Weight")

elif bmi>=24.5 and bmi<=29.9:

print("Over Weight")

elif bmi>=30:

print("OBESE")

OUTPUT

RAPTOR
Q2- In the supermarket there is an offer, if your bill is more than 500 AED
you get 10% of discount, if it is more than 1000AED then you get 15% of
discount, for all purchase above 2000AED you get 20%of discount.
Calculate the final bill amount.

INPUT

bill = int (input("What is the bill amount? "))


dis_a = 10/100
dis_b = 15/100
dis_c = 20/100
dis_d = 50/100

if bill >= 5000:


newamount = bill - (bill * dis_d)

elif bill >= 2000:


newamount = bill - (bill * dis_c)

elif bill >= 1000:


newamount = bill - (bill * dis_b)

elif bill >= 500:


newamount = bill - (bill * dis_a)

else:
print ("Sorry, no discount will be given.\n")
print ("***************************")
print ("The bill amount is: ",bill)
print ("***************************")
exit()

print ("***************************")
print ("The original bill amount was: ",bill)
print ("The amount of cashback you got: ",(bill-newamount))
print ("The new bill amount is",newamount)
print ("***************************")

OUTPUT

RAPTOR

You might also like