I am on Lesson 2 of MIT 6.00. Anytime I type an "if", it won't let me type the "else"
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
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.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
how do you mean? Is it giving you an error? Are you remembering the colon at the end of the if statement? ex: if x > 2:
I'm completely new to this, so let me give a little background info... I'm running Lion on my MacBook Pro. I installed Macports and Xcode. I open Terminal, and then type Python and press enter. When I enter this in:
￼x = 15
if (x/2)*2 == x:
else: print 'Odd'
After I hit "Enter" (having gotten to the "print 'Even' part) it gives me this error:
File "", line 2
IndentationError: expected an indented block
hmmm, not sure about it in terminal, I use IDLE (another python shell, that sounds like it works the same as you're doing in terminal).
does it indent automatically for you after you hit enter after the if statement line? If not, are you hitting tab or several space bars?
I ran into a problem like this yesterday where I was copy/pasting some of my stuff around and it read an indent as several spaces instead of a tab and gave me a similar error.