Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

i have a slight hitch in a small piece of code consider a nested if else is showing an error on the else line (which is within another else)......can somebody help me out with right syntax?

MIT 6.00 Intro Computer Science (OCW)
See more answers at
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer


To see the expert answer you'll need to create a free account at Brainly

you can't have an else without an if first consider using various combinations of if, elif (else if), and else in that order
you might want to use proper blocks for nested ifs. for example if { if{ ... code. } else { } } else { } basically u need to understand you indentations. if you want to put a nested if in your if, u need to create a block with {} and add your nested if-else in there.
to answer the question better it helps if you post the code. from the sound of how you worded it you have an if/else statement and then just an else statement nested within the first else? if so you need the pairing if statement also nested under the same first else statement like this: if: code else: code if: code else: code similar to what onyrock posted but im assuming your programming in python not c so you dont use the brackets

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

ronin12 is right. better to post the code.

Not the answer you are looking for?

Search for more explanations.

Ask your own question