Quick actions

cmd+k|ctrl+k

Navigation

Languages

ternary if

Snippet info

Language

Python

Visibility

public

Author

chausage

Created

2024-12-04T03:48:55.867713Z

Updated

2024-12-04T03:59:57.854726Z

x=1
def a(y):
    print (y)
if x>0:
    x=x+1
else:
    x=x-1
print (x)
#ternary if    
x=-1
z=a(x+1 if x>0 else x-1)
print (z)
INFO