To explain the necessity of elif as opposed to multiple if/else statements, consider the following task:A student has turned in his assignment. You must assign a grade based on the amount of correct answers the student has.
Your program will have 1 input, the amount of correct answers in percentage, as an integer between 0 and 100.
A result of 90 or greater, yet still below or equal to 100, will produce an A.
A result between 80 and 89 will produce a B.
A result between 70 and 79 will produce a C.
Any other input will will result in a failing grade (F).
Your program must return the grade as a character: A, B, C, or F.
I just made this in the BASH language and it's 13 lines long. I could make it 10, but using best practices I get 13.
I'll post my code once you show me some code that uses elif.
With the inputs being 100, 80, 79, 30, 0, 101, -1 respectively, you should be getting A, B, C, F, F, F, F
As for the syntax question in post #35, don't forget Python uses leading whitespace instead of curly braces to indicate grouping of statements. The way your code is written right now should be a syntax error in itself:
Your 'if' expression need a boolean expression to even know if it has to enter the 'if', go to the next 'elif', if any, or finally go to the 'else' statement.
The line with the 'if' has an expression it has to evaluate, which is why 'code can exist on the same line' as the 'if'.
The answer to the raw_input command would be the latter of the 2:
output = raw_input("Please write something now:")
Doing the former you suggested, aside from being a syntax error, would be an attempt to reassign the raw_input function.