Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strs = []
- input_str = ""
- while input_str != "Конец":
- input_str = input()
- if (input_str != "Конец"):
- strs.append(input_str)
- year = input()
- search_strs = []
- for s in strs:
- split_s = str.split(s, ", ")
- if split_s[1] == year:
- search_strs.append(split_s[0] + " (материал - " + split_s[2] + ")")
- output = ""
- if (len(search_strs) == 0):
- output = "В этот год никто не покупал волшебные палочки"
- else:
- output = "В " + year + " году волшебную палочку купили: "
- i = 0
- for s in search_strs:
- output += s
- i += 1
- if (i != len(search_strs)):
- output += ", "
- else:
- output += '.'
- print(output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement