A growth rate with missing parentheses
Code review · Medium · §5.2 Order of operations
This code calculates how much the followers grew since yesterday, as a percentage. The growth rate is the increase divided by yesterday's follower count, times 100. The code runs without errors, but it shows 50.0%. Fix just one line so that it shows 25.0%.
Code to fix
yesterday = 120
today = 150
growth = today - yesterday / yesterday * 100
print(f"Growth rate: {growth:.1f}%")Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.