+ 2

I don't understand Arguments

To be exact, I don't understand how this code outputs number 8! >>> def function(variable): variable += 1 print(variable) >>>

16th Mar 2018, 8:49 PM
Lilek
Lilek - avatar
4 odpowiedzi
+ 7
It is a function definition. It adds 1 to its argument and prints the augmented value. The above will print 8 only if you call the function with 7 as argument.
16th Mar 2018, 9:18 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
16th Mar 2018, 9:28 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Could you write an example code? The one in my course is confusing to me.
16th Mar 2018, 9:25 PM
Lilek
Lilek - avatar