Python Forum
Newtons problem - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Newtons problem (/thread-2300.html)



Newtons problem - Miraclefruit - Mar-06-2017

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


RE: Newtons problem - micseydel - Mar-06-2017

You're off by a 0 in your k constant.


RE: Newtons problem - Miraclefruit - Mar-06-2017

(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