![]() |
Syntax error
Hey can someone help me correct this code .
This is the part where it says there is a sytax error . :
elif guess < number:And this is the full code . :
#This program uses the if else if program to create the high low gameThanx for help . |
Indentation matters. The "elif" needs to be at the same indentation level as the "if."
Don't you hate it when you get nailed by something like that? |
You'll also want to add in an "else" before the final line of code, or else :
print "Just right!" , will execute when : print "Guess is smaller than number" , does. :
#This program uses the if else if program to create the high low gameI believe that's what you want. |
i think indentation is important for readability and style...but for partitioning code blocks? just switching text editors could fuck up your program. that's stupid. i never got that about python.
|
Wtf..its so sensitive ? lol,..Anyway thanx for helping .
|
Quote:
Personally, I've never had any problems with Python indentation. |
Quote:
:
if guess > number::
if (guess > number) { |
Yeah, I'm with Arevos- it's never been a problem. I love not having curly braces all over the place.
|
Somebody is forgetting their ;;;;;;;;;;; in the Java code! Not only is Java loaded with {}{}{}{}{}, but also with ;;;;;; ! I prefer indentations, have to do it anyway so people can read the code!
Always thought that was the neatest thing about Python. |
elif and if must be in same indent if they are to recieve equal weightage
|
| All times are GMT -5. The time now is 8:39 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC