Reputation:
Whats the concept, why 7 is printed and 5 isn't? What operations are these?
x,y=5,0
test=x**y>0
ans=(5,7)[test]
print(ans)
Upvotes: 3
Views: 34
Reputation: 125
because test will be true so ( 1 )
and your tuple have two values : 0 -> 5 , 1 -> 7 ,
it's logic that ans will containt (5,7)[1] = 7
Upvotes: 2