Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Storage:
- compose = []
- stor = Storage()
- class ValidationError:
- pass
- def add(a,b):
- if not "," in b:
- raise ValidationError
- dct = {a: b}
- stor.compose.append(dct)
- def search(a):
- temp = {}
- buf = "a"
- print(a)
- for i in stor.compose:
- for j in i.keys():
- if j == a:
- buf = j
- temp = i
- print(temp)
- numb = temp[buf]
- count = 0
- numb = numb.split(",")
- count += int(numb[0]) * 60 + int(numb[1])
- sec = f"0.{numb[2]}"
- count += float(sec)
- temp[buf] = count
- return temp
- add("Лунная соната", "5,30,55")
- add("В пещере горного короля", "7,20,31")
- print(stor.compose)
- print(search("В пещере горного короля"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement