0
I need little bit explanation on the below code because I confused and don't understand.
t = 40 def sum(t): t+= 20 return t sum(t) print(t)
3 ответов
+ 2
I think, you should print sum(t).
After you will understand everything....
print(sum(t))
+ 1
When you pass t to sum function it doesn't changes the value of original t , rather it creates a new variable named t .
If you are still confused you should search for mutable and immutable data types in python .
t here is a immutable data type.
+ 1
You have in the function return (t)
Then you call the function with sum(t) but without print. So you dont get a output of the function.
Try it print(sum(t))
Or change the function
Return(t) into print(t)