Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
School assignment
#1
Hi guys,

I need to develop the following.

A program that prompts the user for their age, on basis of their age the program needs to calculate how many "breaths" and how many "heartbeats"the person has had in their life.

This is the data i have to work with

Breaths per minute

Infant ~ 30–60
1–4 years ~ 20–30
5–14 years ~ 15–25
adults ~ 12–20

Average heart rate 67.5 beats per second

Appreciate any help i can get
Reply
#2
Have you written anything yet? Show us some code, and we can help nudge you in the right direction, but we won't write it for you :p
Reply
#3
Hi,

Yes

# Program greeting
Print("This program calculates how many breaths and heartbeats u have had in your lifetime")

# get age
age = int(input('Enter age'))

i know i need to work with the if, if else commands, but i dont know how exactly pls i need help

# Program greeting
Print("This program calculates how many breaths and heartbeats u have had in your lifetime")

# get age
age = int(input('Enter age: '))

bpm_infant = (30 + 20) / 2
bpm_1_to_4 = (20 + 30) / 2
bpm_5_to_14 = (15 + 25) / 2
bpm_adults = (12 + 20) / 2

num_min_day = 24 * 60
num_min_year = 365 * num_min_day
heart_rate_day = 67,5 * 24 * 60
heart_rate_year = 365 * heart_rate_day
This is how far I am right now Angel
Reply
#4
If statements are shows in the python documents tutorial here, and comparisons
Reply
#5
thnx seems like ive got some reading to do
Reply
#6
One possible way:
  1. Pre-compute how much heartbeats/breaths you have at the age limits given
  2. Given an age:
  • find the age category,
  • add the pre-computed data for the lower bound of the category to heartbeats/breaths between that lower bound and the actual age.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with a tough school assignment datson79 5 3,323 Feb-18-2019, 06:01 PM
Last Post: ichabod801
  School Work Assignment: Snake Game DarksideMoses 6 5,088 Apr-29-2018, 10:56 PM
Last Post: DarksideMoses
  Array to get profit (school assignment) harryvandervelden 2 2,786 Nov-28-2017, 05:48 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020