+ 1

I keep getting an unindent does not match any outer indentation level errror when i try to run this code

Hello, I am new to coding and just started about a month ago, i have been learning from this site & python for dummies Right now python for dummies gave me this project, make a breakfast menu with input so a user can choose a full course meal if i am looking at this right & understanding this right he is trying to teach me how to nest functions, arguments, variables & input This is the code i typed but keep getting this error print("1. Eggs") print("2. Pancakees") print("3. Waffles") print("4. Oatmeal") MainChoice = int(input("Choose a breakfast item: ")) if (MainChoice == 2): Meal = "Pancakes" elif (MainChoice == 3): Meal = "Waffles" if (MainChoice == 1): print("1. Wheat Toast") print("2. Sour Dough") print("3. Rye Toast") print("4. Pancakes") Bread = int(input("Choose a type of bread: ")) if (Bread == 1): print("You chose eggs with wheat toast.") elif (Bread == 2): print("You chose eggs with sour dough.") elif (Bread == 3): print("You chose eggs with rye toast.") elif (Bread == 4): print(" You chose eggs with pancakes.") else: print("We have eggs, but not that kind of bread.") elif(MainChoice == 2) or (MainChoice == 3): print("1.Syrup\n. Strawberries\n.3 Powdered Sugar") Topping= int(input("Choose a topping: ")) if (Topping == 1): print("You chose " +Meal+ " with syrup.") elif (Topping == 2): print("You chose " +Meal+ " with strawberries.") elif (Topping == 3): print("You chose " +Meal+ "with powdered sugar.") else: print("We have" +Meal+ ", but not that topping.") elif (MainChoice == 4): print("You chose oatmeal.") else: print("We don't serve that breakfast item!") print("We don't serve that breakfast item!") elif (Mainchoice == 2) or (Mainchoice == 3): <--- Indentation error:Unindent does not match any outer indentation level

21st Jan 2018, 6:27 PM
Matt Hathaway
Matt Hathaway - avatar
7 ответов
+ 4
Your indention looks odd. I have tried to fix it: https://code.sololearn.com/c4j8w9UZWai6/?ref=app
21st Jan 2018, 8:06 PM
Paul
Paul - avatar
+ 3
I would made them either lists or dictionaries and then chain them together.
21st Jan 2018, 6:13 PM
Elias Papachristos
Elias Papachristos - avatar
+ 2
The reason you're getting an error is because Sololearn doesn't allow you to repeatedly prompt the user for input (which I find slightly annoying). This code should, however, work if you use a Python IDE such as Pycharm or IDLE because they do support this type of code. Hope this helped!
21st Jan 2018, 6:10 PM
Faisal
Faisal - avatar
+ 2
Huh, it seems that would've helped. 😕 To make a list, just set a variable to square brackets with a certain number of elements inside of them (Sorry that was a pretty bad explanation) Take this for example: list = [first,second,third] In this list, it consists of three elements. To get one of the elements in a list, call the list followed by the index number of whatever element you want in your list: print(list[0]) #This will call the first item on the list This is a pretty good website if you want to get more into lists-http://www.pythonforbeginners.com/basics/JUMP_LINK__&&__python__&&__JUMP_LINK-list-manipulation What I would suggest it maybe try taking away the brackets in the if, elif, and else statements and see if that does anything.
21st Jan 2018, 6:25 PM
Faisal
Faisal - avatar
+ 2
The Python Tutorial here at SoloLearn will help you. You can also check the following link: http://www.pythonforbeginners.com/lists/
21st Jan 2018, 6:26 PM
Elias Papachristos
Elias Papachristos - avatar
+ 1
Hey faislal, I am attempting it in python 3.6 IDLE & VS Code neither are working for some reason. :/ @Elias how do i make them lists? Sorry very new to all of this. Thank you
21st Jan 2018, 6:18 PM
Matt Hathaway
Matt Hathaway - avatar
0
sorry for late reply but I ended up figuring it out, indentation was way off from elif mainchocie 2 and 3. got it working now thanks ! If anyone wants to see the result that worked please let me know and I would be happy to share.
31st Jan 2018, 6:20 PM
Matt Hathaway
Matt Hathaway - avatar