cara membuat pengaturan inventaris dasar di python
"""
-==basic inventory setup=--
"""
from math import ulp
import os
import keyboard
import time
#starter
os.system('cls' if os.name == 'nt' else 'clear')
inventory = 1
#discriptions
print("1)press e to open your inventory\n2)press the number dat you wont to print\n3)press p to print\n4)press left or right keys to go btwin 1 to 9\n(press d to delete all)")
while True:
#key detecter
inputer = keyboard.read_key()
time.sleep(0.2)
#inventory print
if inputer == "p":
if inventory == 1:
print("-")
else:
if inventory == 2:
print("--")
else:
if inventory == 3:
print("---")
else:
if inventory == 4:
print("----")
else:
if inventory == 5:
print("-----")
else:
if inventory == 6:
print("------")
else:
if inventory == 7:
print("-------")
else:
if inventory == 8:
print("--------")
else:
if inventory == 9:
print("---------")
#inventory show
if inputer == "e":
print("[1] -\n[2] --\n[3] ---\n[4] ----\n[5] -----\n[6] ------\n[7] -------\n[8] --------\n[9] ---------\n[selected] %s" % inventory)
#print deliter
if inputer == "d":
os.system('cls' if os.name == 'nt' else 'clear')
#inventory selecter
if inputer == "left":
inventory -= 1
if inputer == "right":
inventory += 1
if inventory == 10:
inventory = 1
if inventory == 0:
inventory = 9
if inputer == "1":
inventory = 1
if inputer == "2":
inventory = 2
if inputer == "3":
inventory = 3
if inputer == "4":
inventory = 4
if inputer == "5":
inventory = 5
if inputer == "6":
inventory = 6
if inputer == "7":
inventory = 7
if inputer == "8":
inventory = 8
if inputer == "9":
inventory = 9
Homeless Hippopotamus