I’m new to python and I’ve written some code for a small asset trading game, and the ‘sell’ feature I’ve tried to incorporate just isn’t working at all.

```
print("Loading...")
#Put all imports in here-
import replit
import random
#-
replit.clear()
print("Welcome to Trading Simulator! " + "\n" + "This is a game about trading virtual items for a made up" + "\n" + "currency (kaz)." + "\n" + "To enter a buy/sell order type <buy/sell> <item> <amount>." + "\n" + "Have fun!")
print("\n" + "---------------------------------------------------------" + "\n" + "---------------------------------------------------------" + "\n" + "Scroll up to see instructions" + "\n")
woodowned = 0
sandowned = 0
brickowned = 0
fruitowned = 0
gemsowned = 0
metalowned = 0
vegetablesowned = 0
buysellloop = 1
kaz = 1000
price = 0
day = 1
shoploop = 1
gameloop = 1
dayloop = 0
shoplst = ["-WOOD-", "-SAND-", "-BRICK-", "-FRUIT-", "-GEMS-", "-METAL-", "-VEGETABLES-"]
while shoploop > 0:
print ("\n" + "Day: " + str(day))
day = sum = day + 1
print("Kaz: " + str(kaz))
while dayloop < 7:
woodprice = random.randint(20,50)
sandprice = random.randint(1,5)
brickprice = random.randint(40,90)
fruitprice = random.randint(50,90)
gemsprice = random.randint(500,2000)
metalprice = random.randint(200,1000)
vegetablesprice = random.randint(50,90)
if dayloop == 0:
price = woodprice
owned = woodowned
print ("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 1:
price = sandprice
owned = sandowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 2:
price = brickprice
owned = brickowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 3:
price = fruitprice
owned = fruitowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 4:
price = gemsprice
owned = gemsowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 5:
price = metalprice
owned = metalowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
if dayloop == 6:
price = vegetablesprice
owned = vegetablesowned
print("\n" + shoplst[dayloop] + "\n" + "Price: " + str(price) + " " + "Owned: " + str(owned))
dayloop = sum = dayloop + 1
shoploop = 0
buysellloop = 1
while buysellloop == 1:
buyorsell = input("\n" + "Buy or sell?: ")
buyorsell.lower()
whatstock = input("Which stock?: ")
whatstock.lower()
amounttobuyorsell = int(input("How much?: "))
if whatstock == "wood":
stocktobuyprice = woodprice
if whatstock == "sand":
stocktobuyprice = sandprice
if whatstock == "brick":
stocktobuyprice = brickprice
if whatstock == "fruit":
stocktobuyprice = fruitprice
if whatstock == "gems":
stocktobuyprice = gemsprice
if whatstock == "metal":
stocktobuyprice = metalprice
if whatstock == "vegetables":
stocktobuyprice = vegetablesprice
if buyorsell == "buy":
memorykaz = kaz
kaz = sum = kaz - int(amounttobuyorsell * stocktobuyprice)
if whatstock == "wood":
woodowned = sum = woodowned + amounttobuyorsell
if whatstock == "sand":
sandowned = sum = sandowned + amounttobuyorsell
if whatstock == "brick":
brickowned = sum = brickowned + amounttobuyorsell
if whatstock == "fruit":
fruitowned = sum = fruitowned + amounttobuyorsell
if whatstock == "gems":
gemsowned = sum = gemsowned + amounttobuyorsell
if whatstock == "metal":
metalowned = sum = metalowned + amounttobuyorsell
if whatstock == "vegetables":
vegetablesowned = sum = vegetablesowned + amounttobuyorsell
if kaz < 0:
buysellloop = 1
kaz = memorykaz
else:
buysellloop = 0
shoploop = 1
dayloop = 0
#The problem seems to be from here...
else:
memorykaz = kaz
kaz = sum = kaz + int(amounttobuyorsell * stocktobuyprice)
if whatstock == "wood" and woodowned > 0:
woodowned = sum = woodowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "sand" and sandowned > 0:
sandowned = sum = sandowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "brick" and brickowned > 0:
brickowned = sum = brickowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "fruit" and fruitowned > 0:
fruitowned = sum = fruitowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "gems" and gemsowned > 0:
gemsowned = sum = gemsowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "metal" and metalowned > 0:
metalowned = sum = metalowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
if whatstock == "vegetables" and vegetablesowned > 0:
vegetablesowned = sum = vegetablesowned - amounttobuyorsell
buysellloop = 0
shoploop = 1
dayloop = 0
else:
buysellloop = 1
kaz = memorykaz
#... to here
```

Can anyone tell me what is wrong?