Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
jeevan-khatri
Data-Science-Lab
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
Data-Science-Lab
/
lab1
/
qn10
/
age.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
29 lines (27 loc) · 1.27 KB
main
Breadcrumbs
Data-Science-Lab
/
lab1
/
qn10
/
age.py
Copy path
Top
File metadata and controls
Code
Blame
29 lines (27 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 10. Write multiple python files with separate functions for the following cases:
# a. A program that takes the age of an user, and gives their birth year, and if birth
# year was a leap year.
# b. A program that computes the Body Mass Index (BMI) of a user, taking their
# height and weight as input. The program should allow the user to enter their
# height in either feet/inches or centimeters and their weight in either kilograms or
# pounds.
# Extend the program to convert BMI into a category based on standard criteria:
# ■ Underweight: < 18.5
# ■ Normal weight: 18.5 - 24.9
# ■ Overweight: 25 - 29.9
# ■ Obese: ≥ 30
# c. A program that checks if a user is eligible for army entrance based on their BMI
# and age. The eligibility criteria are as follows:
# ■ Age must be between 18 and 40 years.
# ■ BMI must be within the range of 18.5 to 29.9.
def birth_year_and_leap(age):
from datetime import datetime
current_year=datetime.now().year
year_of_birth=current_year-age
print("Year of Birth:",year_of_birth)
if (year_of_birth%4==0 and year_of_birth%100 != 0) or (year_of_birth%400==0):
print("Birth year was a leap year")
else:
print("Birth year was not a leap year")
age=int(input("Enter your age:"))
birth_year_and_leap(age)
You can’t perform that action at this time.