A
last year
Adeyemicountry asked

Why are some lines left empty in code? For example, why would someone leave line 4 empty and jump to line 5?

Sudip Bhandari
Expert
last year

Leaving an empty line in code is simply a common practice to make the code more readable.
It doesn’t affect how the code is executed at all.

When the code gets longer, we often leave empty lines to separate different parts or group related actions together—this makes it easier to read and understand.

For example:

color1 = "blue"
print(color1) 

color2 = "pink"

color1 = color2

print(color1) 
print(color2)

In this code:

  • The first two lines are about creating and printing color1.

  • The next group changes the value of color1 and prints both color1 and color2.

Hope this clears things up! Let me know if you have more questions.

Python
This question was asked as part of the Getting started with Python course.