PyTricks icon indicating copy to clipboard operation
PyTricks copied to clipboard

Netsed if else

Open satyasahoo210 opened this issue 6 years ago • 0 comments

Traditional way

if a > 7:
    b = '>7'
elif a == 7:
    b = '7'
else:
    b = '

hack

b = '>7' if a > 7 else '7' if a == 7 else '<7'

satyasahoo210 avatar Aug 29 '19 14:08 satyasahoo210