+ 1
Help me with the in statement
Do you put it this way: nan = "help" if "h" in nan: nan = 4 or a another way
3 Answers
+ 3
If you want to assign 4 as new value to variable nan, then this code does that, because "h" is indeed in "help", so the if condition is met.
+ 3
It's a specific condition checking keyword that turns up a Boolean value. A condition is either true or (not true) /false. It's that True or False that is called a Boolean.
True == 1, False == 0
There's the bool() function that I realize I don't know how to use, in case you're interested:
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/methods/built-in/bool
I'll learn it now, thanks, lol
(edited for clarity)
0
So your saying in is a boolean