Help me with the in statement | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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

26th Jun 2022, 10:34 PM
Moe Williams
Moe Williams - avatar
3 Antworten
+ 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.
26th Jun 2022, 10:41 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 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)
26th Jun 2022, 10:48 PM
Korkunç el Gato
Korkunç el Gato - avatar
0
So your saying in is a boolean
26th Jun 2022, 10:43 PM
Moe Williams
Moe Williams - avatar