newbie learning python here. Doing a course online and ran into some trouble here:
Why does my 'if' code with != '' return true when I input 0, which is supposed to be a falsey value?
Here is the code
print('Enter a name')
name = input()
if name != '':
print('Thank you for entering a name, ' + name)
else:
print('You didn\'t enter a name')
The output is:
Enter a name
0
Thank you for entering a name, 0
Aucun commentaire:
Enregistrer un commentaire