Home>


I'm new to Python.
I'm currently studying Python with the book "Self-learning programmer", but the execution result of this image is not displayed. I use IDLE. Sorry for the rudimentary question, but please give me an answer.

  • Answer # 1

    def f (x):
        return x + 1
        z = f (4) # Since the indent of z is nested one level, it is defined as function: x.

    Enterreturn x + 1so that it looks like the following, and press the line feed key twice.

    def f (x):
        return x + 1
    z = f (4)

  • Answer # 2

    It will return first, so it will not be executed after that.

  • Answer # 3

    python is inddent (line character Down) is important.

    `` python     return x + 1     z = f (4)

    
    `` python
        return x + 1
    z = f (4)


    Has a completely different meaning.

    Be careful when you type in the book code yourself.