MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/PythonLearning/comments/1mpuzhh/why_i_didnt_getting_default_value/n8nwud3/?context=3
r/PythonLearning • u/Red_Priest0 • Aug 14 '25
18 comments sorted by
View all comments
8
Because you call the function with a parameter. Even an emtpy string is still a parameter passed to the function.
Only if you call the function without a parameter, the default would kick in. Try hello() instead to see how that changes the output.
hello()
0 u/Red_Priest0 Aug 14 '25 I want default when there is no input from user 1 u/PureWasian Aug 14 '25 Did you make the change mentioned in another comment? Are you still stuck on what this means?use an if statement to determine if the user input is emptyyou can check if the input is empty (or something else which you don't want) then call hello(), otherwise call hello(name)
0
I want default when there is no input from user
1 u/PureWasian Aug 14 '25 Did you make the change mentioned in another comment? Are you still stuck on what this means?use an if statement to determine if the user input is emptyyou can check if the input is empty (or something else which you don't want) then call hello(), otherwise call hello(name)
1
Did you make the change mentioned in another comment? Are you still stuck on what this means?
use an if statement to determine if the user input is empty
you can check if the input is empty (or something else which you don't want) then call hello(), otherwise call hello(name)
8
u/JeLuF Aug 14 '25
Because you call the function with a parameter. Even an emtpy string is still a parameter passed to the function.
Only if you call the function without a parameter, the default would kick in. Try
hello()instead to see how that changes the output.