+ 2
A python basic question
the result of this code prints >HI! but i didnt called the function, can anyone interpret what is happening here? def some_func(): print("Hi!") var = some_func() print(var)
3 Respostas
+ 1
You called it via the variable "var".
+ 1
i thought var only contains the return value,
+ 1
If there was a return value, var would be assigned to it. But the entire loop would have been checked, and it would have printed hi either way.