If statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If statement

How to write both command in one line or one if statement like If (num>5 and num<47): print('bigger than 5') Print('smaller than 47') else: Print('sorry number is not between 5 and 47) Is this correct??

8th Jul 2018, 11:06 PM
Jibran Saifullah
Jibran Saifullah - avatar
1 Answer
+ 2
First of all, note that Python is not a free-form language. Meaning we don't get to choose our own "style/structure" of writing code. Also note that the "print()" MUST begin with a small letter, I think that's what is wrong with your code
8th Jul 2018, 11:17 PM
Dlite
Dlite - avatar