+ 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")
3 Réponses
+ 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")
+ 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")
...
+ 2
Don't forget '=' and '==' are different;
'=' : assignment operator
'==' : relational/comparison operator
I have seen
if x = 6;
which should be
if x == 6