Skip to content

Instantly share code, notes, and snippets.

@Developer1Dev
Forked from Eserthesay/if_else1.py
Created May 25, 2020 14:22
Show Gist options
  • Save Developer1Dev/ded066b13becbb7f9aa048a40092cb69 to your computer and use it in GitHub Desktop.
Save Developer1Dev/ded066b13becbb7f9aa048a40092cb69 to your computer and use it in GitHub Desktop.
list_ex1=[1,5,7,-10,12,14,-16,-8,0]
pos=[]
neg=[]
neg.append(list_ex1[0]) if list_ex1[0]<0 else pos.append(list_ex1[0])
neg.append(list_ex1[1]) if list_ex1[1]<0 else pos.append(list_ex1[1])
neg.append(list_ex1[2]) if list_ex1[2]<0 else pos.append(list_ex1[2])
neg.append(list_ex1[3]) if list_ex1[3]<0 else pos.append(list_ex1[3])
neg.append(list_ex1[4]) if list_ex1[4]<0 else pos.append(list_ex1[4])
neg.append(list_ex1[5]) if list_ex1[5]<0 else pos.append(list_ex1[5])
neg.append(list_ex1[6]) if list_ex1[6]<0 else pos.append(list_ex1[6])
neg.append(list_ex1[7]) if list_ex1[7]<0 else pos.append(list_ex1[7])
neg.append(list_ex1[8]) if list_ex1[8]<0 else pos.append(list_ex1[8])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment