Homework
This commit is contained in:
12
heimavinna.py
Normal file
12
heimavinna.py
Normal file
@@ -0,0 +1,12 @@
|
||||
problems = input().strip().split(";")
|
||||
expanded = []
|
||||
for problem in problems:
|
||||
if "-" in problem:
|
||||
start = int(problem[: problem.index("-")])
|
||||
stop = int(problem[problem.index("-") + 1 :])
|
||||
for i in range(start, stop + 1):
|
||||
expanded.append(i)
|
||||
else:
|
||||
expanded.append(int(problem))
|
||||
expanded = set(expanded)
|
||||
print(len(expanded))
|
||||
Reference in New Issue
Block a user