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

Practical 4

Uploaded by

riddhipatel5820
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)
13 views3 pages

Practical 4

Uploaded by

riddhipatel5820
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/ 3

Practical 4.

1
Aim-A year is a Leap year if it is divisible by 4, unless it is a century
year that is not divisible by 400 (1800 and 1900 are not leap years,
1600 and 2000 are leap years). Write a program that calculates
whether a given year is a leap year or not.

year=int(input("enter a year:"))
if(year%4==0 and year%100!=0)or(year%400==0):
print(year,"year is leap year.")
else:
print(year,"year is not leap year.")

output :-
Practical-4.2
Aim-Many companies pay time-and-a-half for any hours worked
above 40 hours in a given week. Write a program to input the number
of hours worked and hourly rate and calculate the total wages for the
week.

hours_worked=float(input("enter the number of hours worked in a week:"))


hourly_rate=float(input("Enter the hourly rate:"))
if hours_worked<=40:
total_wages=hours_worked*hourly_rate
else:
regular_hours=40
overtime_hours=hours_worked-regular_hours
regular_wages=regular_hours*hourly_rate
overtime_wages=overtime_hours*(hourly_rate*1.5)
total_wages=regular_wages+overtime_wages
print("the total wages for the week are:$",round(total_wages,2))

Output:-
Practical - 4.3
Aim-The Body Mass Index (BMI) is calculated as a person's weight
(in kg), divided by the square of the person's height (in meters). If the
BMI is between 19 and 25, the person is healthy. If the BMI is below
19, then the person is underweight. If the BMI is above 25, then the
person is overweight. Write a program to get a person's weight (in
kgs) and height (in cms) and display a message whether the person is
healthy, underweight or overweight. 𝐵𝑀𝐼 = 𝑊𝑒𝑖𝑔ℎ𝑡 𝑖𝑛 𝑘𝑔
(𝐻𝑒𝑖𝑔ℎ𝑡 𝑖𝑛 𝑚) 2

weight=float(input("Enter your weight in Kilograms:"))


height=float(input("Enter your height in height:"))
height=height/100
BMI=weight/(height*weight)
if BMI>=19 and BMI<=25:
print("YOU ARE HEALTHY")
elif BMI<19:
print("YOU ARE UNDERWEIGHT")
else:
print("YOU ARE OVERERWEIGHT")

output :-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy