Netsed if else
satyasahoo210 opened this issue · comments
Traditional way
if a > 7: b = '>7' elif a == 7: b = '7' else: b = '<7'
hack
b = '>7' if a > 7 else '7' if a == 7 else '<7'
Collection of less popular features and tricks for the Python programming language
satyasahoo210 opened this issue · comments
if a > 7: b = '>7' elif a == 7: b = '7' else: b = '<7'
b = '>7' if a > 7 else '7' if a == 7 else '<7'