-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathword_counter.py
44 lines (29 loc) · 1 KB
/
word_counter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Tugas Jummlah Kata _______________________________________________
# katax = str(input('kata = '))
# kata = katax.lower()
# semua_kata = kata.split(' ')
# list_kata = list(set(semua_kata))
# def jumlah_kata(x):
# d = {}
# for b in range (len(list_kata)):
# d[list_kata[b]] = 0
# for a in range (len(semua_kata)):
# for key,val in d.items():
# if key in semua_kata[a]:
# d[key] += 1
# return d.items()
# def hasil(x):
# for key,val in jumlah_kata(x):
# print("Jumlah kata '{}' adalah sebanyak {}".format(key,val))
# return
# hasil(kata)
# alternate answer ()()()()()
#Tugas Cari Kata ___________________________________________________
# list1 = ['Merdeka','Helo','Sohib','Kari Ayam']
# list2 = []
# inputx = str(input('Search : '))
# for a in range (len(list1)):
# if inputx in list1[a].lower():
# list2.append(list1[a])
# print(list2)
# ALternate answer ()()()()()