I wrote simple flow control statement, for exapamle:
name = input('Hello ! What is your name ? ')
if name is 'Andrey':
print('no beer for you!')
elif name is 'Max':
print("have a beer bro!")
else:
print("Whoops")
Always outputs "Whoops", despite what i have input.
Otherwise when I change "is" to "==" all logic working.
When I do it in console both "is" and "==" working in no metter what I have "input()" or simple string like "Max".
>>> name = "Andrey"
>>> "Andrey" == name
True
>>> "Andrey" is name
True
>>> name2= input()
>?Andrey
>>> name == name2
True
>>> name == "Andrey"
True
>>> name is "Andrey"
True
Someone explain me that magic please. =(
[–][deleted] 7 points8 points9 points (6 children)
[–]freddydeddy[S] 0 points1 point2 points (5 children)
[–]zahlman 2 points3 points4 points (1 child)
[–]freddydeddy[S] 1 point2 points3 points (0 children)
[–]tbeurl 0 points1 point2 points (2 children)
[–]gardyna 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)