Conversation
| """ | ||
| pc = random.randint(1,100) | ||
| while True: | ||
| try: |
There was a problem hiding this comment.
ten try je lepsi udelt mensi a obalit jen tu cast, kde cekas ten error
| from random import shuffle | ||
|
|
||
| def user_turn(): | ||
| user_list = [] |
| def pc_turn(): | ||
| pc_list = list(range(1,49)) | ||
| shuffle(pc_list) | ||
| return sorted(pc_list[:6]) |
| return sorted(pc_list[:6]) | ||
|
|
||
| def hit(a,b): | ||
| intersection_set = set(a) & set(b) |
There was a problem hiding this comment.
protoze kdyzbys mel dva sety je tady z tech list nemusis zbytecne delat
|
|
||
| def lotto(): | ||
| user = user_turn() | ||
| if user is None: |
There was a problem hiding this comment.
proc by mel byt user None?
|
|
||
| if x == 10: | ||
| print("Don't cheat!") | ||
| if user in answer: |
There was a problem hiding this comment.
tohle je lepsi udelat pres negtivni podminku abyses zbytecne nezanoroval
|
|
||
| @app.route("/", methods=["GET", "POST"]) | ||
| def index(): | ||
| global min_value, max_value, guess |
There was a problem hiding this comment.
globalni prommene nejsou dobra praxe. To se neuc pouzivat. To je hack. Neni to potreba, nainicializuj si je normalne uvnitr
|
|
||
| if parts[1] != "D": | ||
| print("Invalid dice Type") | ||
| sys.exit() |
There was a problem hiding this comment.
uf sys.exit asi ne e. proc ne proste return? nebo vyhod vyjimku kterou jste se ucili
| result = (random.randint(1,int(dice_type))) | ||
| total += result | ||
|
|
||
| if len(parts) >= 5: |
There was a problem hiding this comment.
mas tu celkem komplikovanou logiku celeho toho parsovani a neni to ani spravne. Umozni to zadat nesmysl jako kupr toto roll_the_dice("2D6-1QQQQQQQQ") coz by ten od mel zachytit jako chybny vstup.
To parsovani se typicky dela pres regexy. Tahle je to prilis komplikovane a je to mess. Ja jsem kdyztak nahraval ven svoji vetev tak se muzes podivat jak se to parsuje aby to bylo citelne.
Citelnost je v pythonu dulezita.
Ale jinak jako Good Job.
Je videt ze se snazis a mas potencial
No description provided.