2/19


#1

def spam():
spam="Eggs!"
"""Prints "Eggs!" I hope"""
print spam
spam()

not workin please help


#2

Hi @megasolver18845

Using the following indentation, it works:

def spam():
    spam="Eggs!"
    """Prints "Eggs!" I hope"""
    print spam

spam()

Also, here's a little trick:

Whenever you would like to paste code, since this forum supports Markdown you can use three backticks before and after your code block like so:

```
def more_spam():
lots_of_spam="Spam, Spam & Spam!"
print lots_of_spam

more_spam()
```

and it will retain proper indentation and even have nifty syntax highlighting:

def more_spam():
    lots_of_spam="Spam, Spam & Spam!"
    print lots_of_spam

more_spam()

#3

no help at all but watever


#4

Hi @methodplayer81276,

If you did not understand how my explanation helped, chances are you need more information on indentation.

Pressing the TAB key on your keyboard or using your SPACEBAR to put 4 spaces before typing on a certain line is called indenting a line.

Sometimes indentation just help makes your code easier to read.

When defining a function for exemple, indentation is more than just helpful and more readable, it is mandatory as python make use of this indentation to separate your code into code blocks.

def some_function(some_argument):
    some_argument = 1    # This line is considered the first line of some_function
    some_argument + 1    # This line is considered the second line of some_function
some_argument - 2        # This line is not indented so it will not be considered part of some_function

Here's the gist of it. And if you want more, here's a mouthful :smile:


#5

thank you very much that one did help :smile: