Code for Whitespace


#1

def spam():
eggs = 12
return eggs
        
print spam()

What is Whitespace and what do we need to do in this to make it correct

Also please tell me why are we using whitespace in this to make the program right?


#2

a whitespace is what you get when you press the spacebar, look:

def example():
    print "hello world"

print has 4 whitespaces, in the exercise you can use the tab key to get 4 white spaces. This spacing is called indent.

Python relies on indent/indention to determine what is nested inside a function. many languages use curly brackets or other brackets, but python uses spaces


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.