add task 106

This commit is contained in:
Grzegorz Rogozik 2020-01-12 15:16:54 +01:00
parent 9115788a7d
commit 601a4c9167

View File

@ -3,13 +3,12 @@
"""Rozwiązanie zadania 106."""
def freq_dic(seq):
"""Placeholder"""
dictionary = {}
def penultimate(list,otherwise):
if len(list)<=1:
obj = otherwise
else:
n = len(list)
n = n-2
obj = list[n]
return obj
for xxx in seq:
if dictionary.has_key(xxx):
dictionary[xxx] += 1
else:
dictionary[xxx] = 1
return dictionary