Jun-12-2019, 02:02 PM
random_fruit is in dictionary; you actually don't need items, keys is sufficient:
>>> fruit = {'apples' : 10, 'oranges' :20} >>> random_fruit = random.sample(fruit.keys(), 1)[0] >>> random_fruit 'oranges' >>> fruit[random_fruit] -= 3 >>> fruit[random_fruit] 17
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.