-
-
Save nyancodeid/10d44e1ded84757d88c74d0ab01ff623 to your computer and use it in GitHub Desktop.
python is sucks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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