0
How does this work???
x=6; y=2 if x>6.0 else 3 print (y) Output: 3 How is 6.0 larger than 6???
4 Answers
+ 3
Not larger. that's why 3.
***There are equal.
+ 2
6 > 6.0 is false, hence y = 3
0
Missed the else š¤¦, thanks guys
- 1
Maybe it will be clearer like this:
y = (2 if x>6.0 else 3)
And no, 6 is not greater than 6.0, so 3 š