import numpy as np M = 60 rho = 1.038 c = 3.7 K = 5.4e-3 Ty = 70 Tw = 100 To = 20 """ The formula in this case is quite long. It can be written in a single line: t = ((M ** (2 / 3) * c * rho ** (1 / 3)) / (K * np.pi**2 * (4 * np.pi / 3) ** (2 / 3))) * np.log(0.76 * (To - Tw) / (Ty - Tw)) Such long lines are difficult to read and therefore not recommended. Alternatively, it can be split over several lines: t = ( (M ** (2 / 3) * c * rho ** (1 / 3)) / (K * np.pi**2 * (4 * np.pi / 3) ** (2 / 3)) ) * np.log(0.76 * (To - Tw) / (Ty - Tw)) Note that there are rules to how a line can be split and still understood as a single line by Python. The expression needs to be split inside a parenthesis, not between. """ # But the best solution for long formulas is usually to # split them up in multiple intermediate calculations: a = (M ** (2 / 3) * c * rho ** (1 / 3)) / (K * np.pi**2 * (4 * np.pi / 3) ** (2 / 3)) b = np.log(0.76 * (To - Tw) / (Ty - Tw)) t = a * b # Basic output, time in seconds print(t) # Fancier output, using the modulo operator to convert to minutes and seconds: minutes = int(t / 60) seconds = int(t % 60) print(f"Egget er klart etter {minutes} minutter og {seconds} sekunder") """ Terminal> python egg.py 292.86116565906764 Egget er klart etter 4 minutter og 52 sekunder """