![]() |
My pyguessinggame
Could someone look this over
:
#import whrandom |
Re: My pyguessinggame
I really don't understand how your code could possibly have so many syntax mistakes, yet be code that you've written at the same time. Were you writing this out by hand or something??
Some of the most notable mistakes:
Finally, all of your indentation is completely and utterly wrong. I'm tired of being someone's IDE. These are syntax mistakes. If you're making this many mistakes, then you don't yet understand how to work with Python. You need to learn to follow tutorials carefully, experiment for yourself, and you need to learn how to read the errors shown by the Python Traceback. Fixing all of these mistakes makes the code executable. But it still does not work as required, because the logic of the script is incorrect. I'm not fixing that part for you. :
from random import * |
Re: My pyguessinggame
Quote:
The main problem I had was I couldn't make an "IF" statement follow several different parameters :
eg.) If guess is >0 AND <=100 AND > answer:I also copied some things from an old Python book, so that is the reason for some of the mistakes Finaly I copied the end part that I noted I didn't understand and just switched out some names and variables. And about the "#import whrandom" mistake I copied wrong off the paper it was supposed to read :
#guessgame.py by ******************* (1/20/08)but it is wrong anyways |
Re: My pyguessinggame
Yes. I'm getting tired of it, but that doesn't mean I won't help you. I don't want to be the one who ignores you based on inability to code. We all started somewhere, and so you don't deserve that. I just wish you put a bit of effort into trying to fix the syntax errors.
In reference to your last post's code: :
eg.) If guess is >0 AND <=100 AND > answer:You can get an "if" statement to work that way, like so: :
The main thing you were missing is you have to include the variable 'guess' for each relationship. Python can't just assume what variable you want to use for the next relationship. Note, the brackets aren't necessary. It's just to help show how the statement is broken up. But as for the logic of your program, it's stuck in an infinite loop, because you don't keep asking the user for a new number. You only ask him once. That's one of your problems. |
Re: My pyguessinggame
it was as simple as that :@!!!!!, I didn't think I was actually correct with the 'and' statement. Well now I can re-write the whole thing like I originaly intended to do instead of using someone elses code as a model. I can get this to work, I will resubmit it once I get it done.
|
Re: My pyguessinggame
I am attempting to write the program from scratch right here on the computer
:
#guessgame********** (1/20/08) |
Re: My pyguessinggame
seeing how nobody has said anything I am going to guess It is fine (or its so bad everybody has givin up on me:-/)
|
Re: My pyguessinggame
It's still very incorrect in many ways, but at least if you had Python you seem to have enough potential to fix it. Just get a Python interpreter working on your computer, seriously. :/
|
Re: My pyguessinggame
Will do (once I erase that laptop XP operating system off my 98 desktop:@) then I should be fine, but the computer won't let me past the log in screen (slaps head) Why did I reformat the computer Why! Why! Why!
|
Re: My pyguessinggame
It's not worth other people's time to fix mistakes in your code that a compiler could easily catch. Until you have a working compiler I suggest you refrain from asking others if your code works.
|
| All times are GMT -5. The time now is 2:09 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC