Function arguments (in Python for example)

前端 未结 8 2029
离开以前
离开以前 2020-12-03 16:47

What are [function] arguments? What are they used for?
I started learning Python very recently; I\'m new to programming and I apologize for this basic

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 17:13

    In your example they are not used.

    If your function needs to behave differently depending on what arguments you give it, then what's arguments are for.

    def hi_name(name):
        print 'Hi ' + name
    
    hi_name("John doe")
    

    This prints "Hi John Doe".

    Now back to the basics about functions.

提交回复
热议问题