Skip to content

Commit e073dac

Browse files
authored
Update genericRoutines.py
1 parent 805c84c commit e073dac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

genericRoutines.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ def countOccurancesInList(inp_list):
2828
if x in s:
2929
pass
3030
else:
31-
print(x,inp_list.count(x))
31+
print("{}:{}".format(x,inp_list.count(x)), end=",")
3232
s.add(x)
3333

3434
"""test the function
3535
countOccurancesInList([1,2,3,4,3,2,3,5,6,2,3,5,2,4,6,32,5,1,43,32,2,3,4,21,1,2,4,45,32,1,3,0])
36+
output:
37+
1:4,2:6,3:6,4:4,5:3,6:2,32:3,43:1,21:1,45:1,0:1
38+
3639
"""
3740

3841
############### OR ###############

0 commit comments

Comments
 (0)