""" Ex. 1.12 from "A primer on..." """ from numpy import pi, log M = 47 #mass for a small egg rho = 1.03 c = 3.7 K = 5.4e-3 To = 4 #initial temperature (fridge) Tw = 100 #water temperature Ty = 70 #target temperature for the yolk t = (M**(2/3) * c * rho**(1/3)) / (K * pi**2 * (4 * pi/3)**(2/3)) \ * log(0.76 * (To - Tw)/(Ty - Tw)) print(t) #or, for slightly more sophisticated output: minutes = int(t/60) seconds = int(t%60) #% is the modulo ("rest") operator print(f"The egg is ready after {minutes} minutes and {seconds} seconds")