Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 18 Online
OpenStudy (anonymous):

hi how can i find semantic error

OpenStudy (anonymous):

read thru your code very carefully perhaps? (like through in a value and see what happens)

OpenStudy (anonymous):

As an option, with time you will create a discipline of programming (using Dijkstra's words), which will also include a debugging discipline. Granted that Python has no debugger / compiler, you can put print statements, for instance, to check where the logic error occurred. Do not assume you know where the error is - if there is an error, it's there by programmer's mistake, and you aren't really understanding your code.

OpenStudy (anonymous):

The python IDLE has a debugger that allows you to watch a script run, step by step. I've used that numerous times so that I can watch the program and see what it does to the variables and if they're coming out as I would expect them to. If they don't, it's usually pretty easy to see why they didn't.

OpenStudy (anonymous):

The semantic errors notifies you an improper use of statements. For example: I wan to set a integer variable to 5. Then i increment it by one. MyIntegerVariable=5 MyIntegerVariable++ this is ok but if i Declare MyIntegerVariable with no initial value and the i increment it by 1 i causes a semanthic error because i can't increment by 1 a integer variable with no previous value. MyIntegerVariable MyIntegerVariable++ Semanthic Error

OpenStudy (anonymous):

That being said, in Python, typing MyIntegerVariable++ will also throw an error, although it will be syntax in this case. Python does not have an increment operator like C. The proper syntax to increment by one would be MyIntegerVariable += 1. Admittedly, this is nit picking towards your post gislabs, but since the class is taught in Python my assumption was the OP would be coding in python and attempting to find errors in Python.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!