CARVIEW |
Select Language
HTTP/2 200
date: Wed, 15 Oct 2025 00:44:33 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=c63136f53c090ba309b16097f5fa0537229a8de87df9dfba0f2a516d7aabe63ca%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22PvWSwoYY8W4rkbucjyznegxzRxT37uuC%22%3B%7D; HttpOnly; Path=/
cf-ray: 98eb49e0bad7c1bf-BLR
legos.py - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://viskillz.inf.unideb.hu/prog/#/?week=P1095&exercise=P109504n&page=sheet
- import sys
- from typing import NamedTuple
- LegoSet = NamedTuple("LegoSet", [
- ("number", int),
- ("name", str),
- ("theme", str),
- ("pieces", int)
- ])
- def line_to_lego_set(line: str) -> LegoSet:
- data = line.strip().split(";")
- return LegoSet(int(data[0]), data[1], data[2], int(data[3]))
- def lego_set_to_line(lego_set: LegoSet) -> str:
- return f"{lego_set.name} ({lego_set.number}): {lego_set.pieces} - {lego_set.theme}"
- def distinct_themes(lego_sets: list[LegoSet]) -> set[str]:
- themes = []
- for lego_set in lego_sets:
- themes.append(lego_set.theme)
- return set(list(dict.fromkeys(themes)))
- def read_lego_sets_from_file(file_name: str) -> list[LegoSet]:
- data = []
- with open(file_name, "r") as file:
- for line in file:
- data.append(line_to_lego_set(line))
- return data
- def main():
- data = read_lego_sets_from_file(sys.argv[1])
- themes = distinct_themes(data)
- #for line in data:
- # print(lego_set_to_line(line))
- for theme in themes:
- print(theme)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Make $15OO in 2O minutesV E⭐⭐
Java | 1 sec ago | 0.15 KB
-
💡 EASY MONEY GUIDE ✅ Working
JavaScript | 2 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $9OO INSTANTLY D M⭐⭐
Java | 3 sec ago | 0.15 KB
-
✅ Make $2500 in 20 minutes⭐ 0
JavaScript | 8 sec ago | 0.25 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 12 sec ago | 0.15 KB
-
⚡ Crypto Swap Glitch ✅ Working ⚡
JavaScript | 12 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $9OO INSTANTLY D A⭐⭐
Java | 13 sec ago | 0.15 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 14 sec ago | 0.15 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand