HOW CAN I GET MY CODE TO PRINT TWO STATEMENTS: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

HOW CAN I GET MY CODE TO PRINT TWO STATEMENTS:

x=6 if x=6: print("equal") elif x>4: print("greater") else: print("none")

26th Apr 2019, 5:13 AM
Andrew
Andrew - avatar
3 Answers
+ 3
x=6 if x=6: print("equal") if x>4: print("greater") else: print("none") that would be one way. or x=6 if x=6: print("equal") if x>4: print("greater") if x<5 print("none")
26th Apr 2019, 5:16 AM
Dragonxiv
Dragonxiv - avatar
+ 2
1) if x>4: print("greater") if x==6: print("equal") else: print("none") 2) if x>4 and x==6: print("greater") print("equal") else: print("none") 3) if 4<x==6: print("greater\nequal") else: print("none") ...
26th Apr 2019, 5:57 AM
Solo
Solo - avatar
+ 2
Don't forget '=' and '==' are different; '=' : assignment operator '==' : relational/comparison operator I have seen if x = 6; which should be if x == 6
11th Feb 2020, 5:10 AM
Mark 🇺🇬 INACTIVE
Mark 🇺🇬 INACTIVE - avatar