• Zanmyk

    # ---- Imports -----
    
    from random import choice
    
    # ------ A. Functions ------
    
    # A1. Choose dishes
    
    def chooseDishes(days):
     while len(myMenu) < int(days): 
         ^ #so it seems there's an invalid character in my code and well, i'm at loss trying to figure out what to do with this.
      chosenDish = choice(foodWeLike)
       if chosenDish not in myMenu:
                myMenu.append(chosenDish)
        print("Done! Here's your menu…")
            print()
            for dish in myMenu: 
                    print(dish)
            print()
            print("Out of all these days, my favorite has to be... " + choice(myMenu))
    
    
            
            
            
                
    # A2. Build Shopping list
    
    def buildShoppingList():
          myShoppinglist = []
            if "Pizza" in myMenu: 
            myshoppinglist.append(pizza)
            if "Beef Burgers" in myMenu: 
            myshoppinglist.append(beefBurgers)
            if "Pork Stir Fry" in myMenu: 
            myshoppinglist.append(porkStirFry)
            if "Chicken Fajitas" in myMenu: 
            myshoppinglist.append(chickenFajitas)
            if "Orange Chicken" in myMenu: 
            myshoppinglist.append(orangeChicken)
            if "Lasagna" in myMenu: 
            myshoppinglist.append(lasagna)
            for dish in myShoppinglist:
                for ingredient in dish:
                      print(ingredient)
            
    # ------ B. Lists ----------
    
    foodWeLike = ["Pizza", "Beef Burgers", "Pork Stir Fry", "Chicken Fajitas", "Orange Chicken", "Lasagna",]
    
    pizza = ["Pizza Base", "Tomato Sauce", "Cheese", "Pepperoni"]
    beefBurgers = ["Beef Patties", "Burger Rolls", "Lettuce", "Tomatoes", "Relish"] 
    porkStirFry = ["Pork loin", "Peppers", "Onion", "Hoi Sin Sauce", "Noodles"]
    chickenFajitas = ["Chicken Breast", "Red Peppers", "Onion", "Fajita Kit"]
    orangeChicken = ["Chicken Breast", "Orange Sauce", "Panko crumbs"]
    lasagna = ["Cooked Lasagna Noodles", "Traditional Italian Cheese", "Parmesean Cheese", "Mozzarella Cheese", "Eggs", "Ground Beef", "Ricotta Cheese"]
    
            myMenu = []
            myShoppinglist = []
    
    # 1. How many days to plan?
    
    print("Hello, I'm Munch, i'll help you to plan your dinner menu...")
    
    answer = input("How many days would you like me to plan? ")
    
    print("OK, I'm going to plan " + answer + " dinner(s) from your favorite meals list")
    
    # 2. Choose dishes
    
    chooseDishes(answer)
    
    
    # 3. Build shopping list?
    
    answer = input("Would you like a shopping list for this menu?")
    
    if answer == 'y':
          buildShoppinglist()
    else:
          print("You got it! Bye for now 🙂")
    

    posted in Pythonista read more
  • Zanmyk

    
    

    Insert Code Here

    
    from random import choice
    
    # ------ A. Functions ------
    
    # A1. Choose dishes
    
    def chooseDishes(days):
        while len(myMenu) < int(days):  #this is the only part of the code with an error
    -------------------------------------------------------------------------------------------------
                chosenDish = choice(foodWeLike)
                if chosenDish not in myMenu
                    myMenu.append(chosenDish)
        print("Done! Here's your menu…")
            print()
            for dish in myMenu: 
                    print(dish)
            print()
            print("Out of all these days, my favorite has to be... " + choice(myMenu))
    
    
    # A2. Build Shopping list
    
    def buildShoppingList():
          myShoppinglist = []
            if "Pizza" in myMenu: 
            myshoppinglist.append(pizza)
            if "Beef Burgers" in myMenu: 
            myshoppinglist.append(beefBurgers)
            if "Pork Stir Fry" in myMenu: 
            myshoppinglist.append(porkStirFry)
            if "Chicken Fajitas" in myMenu: 
            myshoppinglist.append(chickenFajitas)
            if "Orange Chicken" in myMenu: 
            myshoppinglist.append(orangeChicken)
            if "Lasagna" in myMenu: 
            myshoppinglist.append(lasagna)
            for dish in myShoppinglist:
                for ingredient in dish:
                      print(ingredient)
            
    # ------ B. Lists ----------
    
    foodWeLike = ["Pizza", "Beef Burgers", "Pork Stir Fry", "Chicken Fajitas", "Orange Chicken", "Lasagna",]
    
    pizza = ["Pizza Base", "Tomato Sauce", "Cheese", "Pepperoni"]
    beefBurgers = ["Beef Patties", "Burger Rolls", "Lettuce", "Tomatoes", "Relish"] 
    porkStirFry = ["Pork loin", "Peppers", "Onion", "Hoi Sin Sauce", "Noodles"]
    chickenFajitas = ["Chicken Breast", "Red Peppers", "Onion", "Fajita Kit"]
    orangeChicken = ["Chicken Breast", "Orange Sauce", "Panko crumbs"]
    lasagna = ["Cooked Lasagna Noodles", "Traditional Italian Cheese", "Parmesean Cheese", "Mozzarella Cheese", "Eggs", "Ground Beef", "Ricotta Cheese"]
    
    myMenu = []
    myShoppinglist = []
    
    # 1. How many days to plan?
    
    print("Hello, I'm Munch, i'll help you to plan your dinner menu...")
    
    answer = input("How many days would you like me to plan? ")
    
    print("OK, I'm going to plan " + answer + " dinner(s) from your favorite meals list")
    
    # 2. Choose dishes
    
    chooseDishes(answer)
    
    
    # 3. Build shopping list?
    
    answer = input("Would you like a shopping list for this menu?")
    
    if answer == 'y':
          buildShoppinglist()
    else:
          print("You got it! Bye for now 🙂")
    

    posted in Pythonista read more
  • Zanmyk

    So i’ve been having trouble with making a while loop in Pythonista and it stems from while not being recognized as a variable, what could possibly be done to fix this or make significant progress in fixing this?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!