Python Forum

Full Version: Newtons problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
You're off by a 0 in your k constant.
(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