0

I don't know why this code prints: Hi None Hi None, can someone tell me why it prints a None at the end?

def some_func(): print("Hi!") var = some_func() print(var) print(some_func())

23rd Apr 2019, 6:34 AM
Poko Kalona
Poko Kalona - avatar
2 Réponses
+ 9
Because your final statement prints the some_func() function which doesn't return a value.
23rd Apr 2019, 7:29 AM
silentlearner
silentlearner - avatar
+ 1
just call the function like this : some_func() it does not return anything so var has nothing.
23rd Apr 2019, 6:46 AM
Bahhaⵣ
Bahhaⵣ - avatar