Fakultas Ilmu Komputer UI

Commit 6a1c7335 authored by Ahmad Dzikrul Fikri's avatar Ahmad Dzikrul Fikri
Browse files

Tugas Pemgrograman Ekstra - Soal 2 Tahap 2 - 1806196806

parent 56ee488a
......@@ -35,6 +35,15 @@ def get_data_jakarta():
mulai1 = akhir
return jumlah_keseluruhan
def get_total_kasus_by_keyword(keyword):
text = get_data("https://pudyprima.github.io/covid19-indonesia").lower()
jumlah = 0
mulai = text.find(keyword.lower())
while text.find(keyword.lower(),mulai)!=-1:
mulai = text.find(keyword.lower(),mulai+1)
jumlah +=1
return jumlah
def main():
print(get_data_per_wilayah('Jakarta Barat'))
print(get_data_per_wilayah('Jakarta Pusat'))
......@@ -42,4 +51,7 @@ def main():
print(get_data_per_wilayah('Jakarta Timur'))
print(get_data_per_wilayah('Jakarta Utara'))
print(get_data_jakarta())
print(get_total_kasus_by_keyword('perempuan'))
print(get_total_kasus_by_keyword('dalam perawatan'))
print(get_total_kasus_by_keyword('jawa tengah'))
main()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment