How do i indent in python code?



  • Be consistent with indentation, use 2 or 4 spaces, in front of lines which need to be indented. Pick one and stick to it.

    e.g:

    def sailing():
     greeting = "Ahoy, me Hearties!"
     return greeting
           
    print(sailing())
    

    Result is.
    >> Ahoy, me Hearties!


Log in to reply
 

© Lightnetics 2024