[Tutor] I need help fast
Adam Dickenson
adamdickenson50252 at gmail.com
Tue Oct 1 18:24:59 EDT 2019
Hello,
Attached are what I need help on. I cannot get them started and they are
due at 11PM tonight. Can someone help?
Thanks,
Adam J. Dickenson
Tompkins County Fire Department Webmaster
Tompkins County Department of Emergency Response
92 Brown Road, Ithaca NY 14850
<https://maps.google.com/?q=92+Brown+Road,+Ithaca+NY+14850+%0D%0A+%0D%0A+607&entry=gmail&source=g>
607-591-5956 <(607)%20591-5956> - Mobile
607-266-8035 <(607)%20266-8035> - Fax
Note: All Faxes will go to Lauren Dickenson.
adamdickenson50252 at gmail.com
http://tompkinsfireems.org/
-------------- next part --------------
'''
to run tests on mac: python3 -m doctest car_speed.py -v
to run tests on Win: python -m doctest car_speed.py -v
'''
def car_speed(distance_of_skid):
'''
Calculate the speed in MPH of a car that skidded
d feet on dry concrete when the brakes were applied
args:
distance_of_skid (float): the distance of the skid in feet
returns:
an estimate of the speed the car was going when the brakes were applied (float)
formula:
speed in MPH equals the square root of (24 * d)
examples/doctest:
the car didn't skid at all
>>> round(car_speed(0), 2)
0.0
the car skid 1 foot
>>> round(car_speed(1), 2)
4.9
the car skid 10 feet
>>> round(car_speed(10), 2)
15.49
the car skid 33.33 feet
>>> round(car_speed(33.33), 2)
28.28
the car skid 12345 feet
>>> round(car_speed(12345), 2)
544.32
'''
# TO DO: Add your code here
return
-------------- next part --------------
'''
to run tests on mac: python3 -m doctest cost_of_running_lightbulb.py -v
to run tests on Win: python -m doctest cost_of_running_lightbulb.py -v
'''
def cost_of_running_lightbulb(cents_per_kw_hour, bulb_wattage, hours_on):
'''
Calculate the cost of running a lightbulb using the formula
wattage x hours used divided by 1000 x cost per kWh in cents
args:
cents_per_kw_hour (float): the cost in cents per kilowatt hour
bulb_wattage (float): the wattage of the bulb
hours_on (float): the number of hours the bulb was on
returns:
the cost of running the lighbulb in dollars
examples/doctests:
1 penny per kw hour, 60 watt bulb, zero hours on
>>> round(cost_of_running_lightbulb(1, 60, 0), 2)
0.0
$0.10 per kw hour, 100 watt bulb, 1 hour on
>>> round(cost_of_running_lightbulb(10, 100, 1), 2)
0.01
$0.10 per kw hour, 100 watt bulb, 100 hours on
>>> round(cost_of_running_lightbulb(10, 100, 100), 2)
1.0
$0.15 per kw hour, 60 watt bulb, 25 hours on
>>> round(cost_of_running_lightbulb(15, 60, 25), 2)
0.1
$11.76 per kw hour, 127 watt bulb, 56789 hours on
>>> round(cost_of_running_lightbulb(1176, 127, 56789), 2)
6.13
'''
# TO DO: Add you code here
print(60 * 1 / 1000 * 0.01)
return
-------------- next part --------------
'''
to run tests on mac: python3 -m doctest triathlon.py -v
to run tests on Win: python -m doctest triathlon.py -v
'''
def triathlon(hours_cycling, hours_running, hours_swimming):
'''
Calculate the number of pounds lost from doing a triathlon
based on the number of hours spent at each exercise
given constants:
200 calories are burned for each 1 hour of cycling
475 calories are burned for each 1 hour of running
275 calories are burned for each 1 hour of swimming
a person looses 1 pound of body weight for each 3500 calories burned
args:
hours_cycling (float): the hours spent cycling
hours_running (float): the hours spent running
hours_swimming (foat): the hours spent swimming
returns:
the number of pounds lost after the triathlon (float)
examples/doctests:
no cycling, running, or swimming
>>> round(triathlon(0, 0, 0), 2)
0.0
1 hour cycling, no running or swimming
>>> round(triathlon(1, 0, 0), 2)
0.06
no cycling, 1 hour running, no swimming
>>> round(triathlon(0, 1, 0), 2)
0.14
no cycling, no running, 1 hour swimming
>>> round(triathlon(0, 0, 1), 2)
0.08
5.5 hours cycling, 3.12 hours running, 2.22 hours swimming
>>> round(triathlon(5.5, 3.12, 2.22), 2)
0.91
'''
# TO DO: Add your code here
return
More information about the Tutor
mailing list