Challenge project saves itself without running

Hi, I am currently on the course of “Learn Object-Oriented Programming with Python & Project Based Learning”. I have completed the basic Python 2 course previously, and my code can run and generate output in the section on the right. However, when I test my code in this project and press ctrl + enter to run it, it generates nothing and only saved my project.


This is my interface, I use the saved web app page for Codecademy because it is more convenient

I thought it was only the problem of my code, but when I tried to run the example answer code, it also does not generate any sort of output. I also tried manually pressing the Save & Run button after restarting the page, but it turned itself into a button that only says ‘Save’.

Here is my code for reference. I am trying to make a dish-ordering project.

class Dish:
  def __init__(self, dishName, dishIngredients, dishPrice, dishPrepTime):
    self.dishName = nameOfDish
    self.dishIngredients = ingredientsNeeded
    self.dishPrice = priceofDish
    self.dishPrepTime = prepTimeOfDish
  
  def editDishName(self):
    successfullNameChange = False
    while successfullNameChange == False:
      newName = input('What do you want to call this dish?')
      if len(newName) > 0:
        if type(newName) == 'string':
          self.dishName = newName
          print('You have successfully changed the name of this dish! This dish is now called {}!\n'.format(self.dishName))
          successfullNameChange = True
        else:
          print('You must enter a string for your new dish name. Your input was: {}. Please try again.\n'.format(newName))
      else:
        print('Your new dish name must not be empty! Your input was: {}. Please try again.\n'.format(newName)) 

###

class Customer:
  def init(self, dishOrdered, addOns = False, tips = 0):
    self.dishOrdered = dishOrdered
    self.addOns = addOns
    self.tips = tips

salad = Dish('Salad', ['Tomato', 'Lettuce', 'Salad dressing'], 3.00, '15 minutes')
salad.editDishName()

(Note that I haven’t yet finished the project, I was just testing if my method works or not)

Here is the link of the project for reference.

Since this is actually running on a terminal, you need to write python script.py where the little dollar sign is in order to compile and run the code you’ve written. Make sure to click on the little hollow rectangle before typing, though.

3 Likes