Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newtons problem
#1
Newton’s Law of Cooling states that when a hot liquid is placed in a cool
room, each minute the decrease in the temperature is approximately proportional
to the difference between the liquid’s temperature and the room’s temperature.
That is, there is a constant k such that each minute the temperature loss is
k # (liquids temperature - rooms temperature). Suppose a cup of 212°F coffee is
placed in a 70°F room and that k = .079. Determine the number of minutes required
for the coffee to cool to below 150°F.


k = 0.79
room = 70
cup = 212 
tempLoss = 0 
minutes = 0 

while (cup > 150): 
    tempLoss = k*(cup - room) 
    cup -= tempLoss
    minutes += 1


print("The coffee will cool to below 150 degrees in 7", minutes, "minutes")
This keeps giving me 1 minute
Reply
#2
You're off by a 0 in your k constant.
Reply
#3
(Mar-06-2017, 02:16 AM)micseydel Wrote: You're off by a 0 in your k constant.

wow i can't believe that was the problem haha. thanks
Reply


Forum Jump:

User Panel Messages

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