0
How to write long if, else code in python.
Example: if i>="a" and I<="z" or i>="A" and i<="z" I>="0" and <="9" if long how can I write this code.
8 odpowiedzi
+ 4
you could split the condition to many lines if you enclose it in parenthesis (that's also better to put explicit parenthesis to not relly too much on operator precedence in and/or chaining wich could be tricky):
if (
( i >= "a" and I <= "z" )
or ( i >= "A" and i <= "z" )
or ( I >= "0" and <= "9" )
):
pass
+ 1
Use if ,elif,elif,.......else
+ 1
visph it's working great
+ 1
Yash Wable 🇮🇳 if I use if ,elif than
My answer print in new line but I want to print in same line.
+ 1
Yash Wable 🇮🇳 if , else is not good for my case but thanks you tell answer
0
Let's me try
0
@Everyone thanks a lot Because of you I could solve sololearn questions.😊😊😊
0
Also I learned new things in if else statement.