Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

creed123 Group Title

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

  • 7 months ago
  • 7 months ago

  • This Question is Open
  1. TuringTest Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    you can't have an else without an if first consider using various combinations of if, elif (else if), and else in that order

    • 7 months ago
  2. onyrock Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • 7 months ago
  3. ronin12 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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

    • 7 months ago
  4. onyrock Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ronin12 is right. better to post the code.

    • 7 months ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.