Как сделать автоматическое извлечение из словаря по цифре ключу?
Python:
import random
chance: int = random.randint(1, 11) #наследство
if chance in frozenset(range(1, 10, 1)):
# print("рарка")
chance: int = random.randint(1, 11)
if chance in frozenset(range(1,5, 1)):
# print("set")
chance: int = random.randint(1, 24) #вещи
drop = {(1, 4): 'set helmet',(4, 7): 'set choker',(7, 10): 'set gloves',(10, 13): 'set armor',(13,16): 'set trousers',(16, 19): 'set boots',(19, 22): 'set bijouterie',(22, 24): 'set weapon'}
if chance in frozenset(range(5, 11, 1)):
# print("unset")
chance: int = random.randint(1, 24) #вещи
drop = {(1, 4): 'unset helmet',(4, 7): 'unset choker',(7, 10): 'unset gloves',(10, 13): 'unset armor',(13,16): 'unset trousers',(16, 19): 'unset boots',(19, 22): 'unset bijouterie',(22, 24): 'unset weapon'}
if chance in frozenset(range(10, 11, 1)):
# print("эпик")
chance: int = random.randint(1, 11)
if chance in frozenset(range(1,5, 1)):
# print("set")
chance: int = random.randint(1, 24) #вещи
drop = {(1, 4): 'set helmet',(4, 7): 'set choker',(7, 10): 'set gloves',(10, 13): 'set armor',(13,16): 'set trousers',(16, 19): 'set boots',(19, 22): 'set bijouterie',(22, 24): 'set weapon'}
if chance in frozenset(range(5, 11, 1)):
# print("unset")
chance: int = random.randint(1, 24) #вещи
drop = {(1, 4): 'unset helmet',(4, 7): 'unset choker',(7, 10): 'unset gloves',(10, 13): 'unset armor',(13,16): 'unset trousers',(16, 19): 'unset boots',(19, 22): 'unset bijouterie',(22, 24): 'unset weapon'}