I am currently writing a program in Python.
One of its main purposes is to obtain items in such a manner that you are required to build different items first. (May be confusing, not to worry.)
Here is my code (With formatting issues apparently);
def options():
command = input("Tree {T}, Mine {M}")
if command == "M" and '':
print("Mining...")
time.sleep(5)
print("Almost done...")
time.sleep(2)
print("You have recieved;")
stone = random.randint(2,4)
print(stone, "stone")
for items in inventory:
if items == "stone":
inventory[items] = inventory.get('stone')+stone
other = random.randint(1,2)
if random.randint(1,5) == 2:
print(other, "other")
for items in inventory:
if items == "other":
inventory[items] = inventory.get('other')+other
The conditional statement on line 2 is left unfinished, which I need help with. I would like to check if there is a value in a dictionary but it has to have a certain key with it.
Aucun commentaire:
Enregistrer un commentaire