Skip to content

Instantly share code, notes, and snippets.

@nyancodeid
Last active March 9, 2020 14:23
Show Gist options
  • Save nyancodeid/10d44e1ded84757d88c74d0ab01ff623 to your computer and use it in GitHub Desktop.
Save nyancodeid/10d44e1ded84757d88c74d0ab01ff623 to your computer and use it in GitHub Desktop.
python is sucks
import mod_3
jum=int(input("Masukkan jumlah bilangan: "))
datas=[]
for index in range(jum):
datas.append(int(input("Masukkan data: ")))
even, odd = mod_3.search_res(datas)
print("\nJumlah bilangan genap:",end=" ")
print(len(even),end=" ")
print("yaitu",end=" ")
for index in even:
print(index,end=" ")
print("\nJumlah bilangan ganjil:",end=" ")
print(len(odd),end=" ")
print("yaitu",end=" ")
for index in odd:
print(index, end=" ")
print("")
def search_res(datas):
datas.sort()
res_data=[[], []]
for data in datas:
if(data%2==0):
res_data[0].append(data)
elif(data%2==1):
res_data[1].append(data)
return res_data[0], res_data[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment