I was hoping to get help with the challenge for challenge 1 in the Python 3 Course. This is my second time going through this section and I wanted to challenge myself to use everything I had learned so far.
This is the code:
sales_tax = 0.88 input_track =  class Item: def __init__(self, name, description, price): self.name = name self.description = description self.price = price def Input_Chain(): customer_input = input("Select Item") if customer_input == 0: Checkout() else: input_track.append(customer_input) Input_Chain() def Checkout(): total = 0 itemization = "" try: for i in input_track: total += i.price itemization += i.name + ": " itemization += i.description + "\n" except: print("An item is not on our list") print("Total Before Tax:" + str(total)) tax = total * sales_tax total += tax print(itemization) print("Total After Tax:" + str(total)) Lovely_Loveseat = Item("Lovely Loveseat", "Lovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches deep. Red or white.",254.00) Stylish_Settee = Item("Stylish Settee", "Stylish Settee. Faux leather on birch. 29.50 inches high x 54.75 inches wide x 28 inches deep. Black.",180.50) Luxurious_Lamp = Item("Luxurious Lamp", "Luxurious Lamp. Glass and iron. 36 inches tall. Brown with cream shade.", 52.15) print(type(Lovely_Loveseat)) Input_Chain()
I tested this code, and everything works up to the part above where it says customer_input = input(“Select Item”). This always reads as a string and I have been unable to find a way to convert it to a readable format to call the class instances.
I was hoping someone could offer a solution to the problem, or perhaps introduce a different way to tackle the problem.
Thank you so much!
Note: trying the code in codecademy will raise an EOD? warning which I found was associated to not having a terminal for input. I’ve been using the code in an IDE as a workaround.