+ 1
Python. Can someone pls explain me this code.
Def func(*args) x = 0 for a in args: x+=a return x/len (args) print (func(3,4,5))
3 ответов
+ 3
indentation looks wrong,
defines function named func.
func takes an unlimited amount of argument which are stored in args denoted by the single *.
adds 1 to x for each arg which is the same thing as length, returns this so should always return 1
+ 3
wait my bad x is the sum of arguments, then divided by the length, so it returns the average
0
thank you so much.