
Edit Robux to work like our grocery item
Step 1: Create a class called robux_item with two different class variables (Name and Price)
Step 2: replace the two dictionaries with 1 dictionary called item_dict
The dictionary should have a key as the id and the value being a robux_item object
example {“1”: robux_item(insert_paramaters_here)}
Step 3 : edit your application loop, so that in the first if statement which makes the transaction, you correctly grab the name and price and insert it into make_transaction
If you lost robux
def make_transaction(item, price):
global wallet
if wallet >= price:
shopping_cart.append(item)
wallet -= price
print(f"You have bought{item}. You now have {wallet} robux left")
else:
print("You have no moneyyyyyy")
while True:
selection = input(menu)
if selection in item_dict.keys():
make_transaction(item_dict[selection],price_dict[selection])
elif selection == "4":
robux_amount = input("How many robux would you like to add")
# "3" ----> 3
if robux_amount.isnumeric():
wallet += int(robux_amount)
print(f"You have added{robux_amount}. You have {wallet}")
elif selection == "5":
break
else:
print("Wrong Selection")
for item in shopping_cart:
print(f"you have bought {item}")
print(f"Your Final Balance is {wallet}")