Skip to content

Commit 5fc955c

Browse files
author
Amogh Singhal
authored
Create calculateFrequency.py
1 parent a1391e6 commit 5fc955c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bits_wilp/calculateFrequency.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def calculateFrequency(str):
2+
nums = str.split()
3+
freq = {}
4+
5+
for i in nums:
6+
if i not in freq.keys():
7+
freq[i] = 1
8+
else:
9+
freq[i] += 1
10+
11+
print(freq)
12+
13+
14+
print("Please enter the numbers seperated by space. \n Press ENTER to exit: ")
15+
x = input()
16+
calculateFrequency(x)

0 commit comments

Comments
 (0)