lesha_xo
Badges: 2
Rep:
?
#1
Report Thread starter 1 year ago
#1
I have no clue what to do with python How do I make sure there are no errors????
0
reply
CheeseIsVeg
Badges: 22
Rep:
?
#2
Report 1 year ago
#2
(Original post by lesha_xo)
I have no clue what to do with python How do I make sure there are no errors????
I've literally only just started to learn python so I'm going to be little use to you :emo:
I can tag the helpful Sanic and Ploogarion to see if they have any advice, provided you are still having issues and can attempt to describe exactly what these are?
:hugs: All the best!

P.S Some links u might like :https://www.python.org/ http://qutip.org/ (doubt that last one will be of use but u know why not and stuff)
0
reply
XOR_
Badges: 20
Rep:
?
#3
Report 1 year ago
#3
Are you coding anything specific or do you mean errors in general? (errors for broken code should show up in the console)
0
reply
lesha_xo
Badges: 2
Rep:
?
#4
Report Thread starter 1 year ago
#4
(Original post by XOR_)
Are you coding anything specific or do you mean errors in general? (errors for broken code should show up in the console)
I mean just in genreal
0
reply
Acsel
Badges: 20
Rep:
?
#5
Report 1 year ago
#5
So there are 2 main types of errors in code. You'll either have errors that break your code (called syntax errors) and errors that make your code do things you don't want (called logic errors).

A syntax error is usually very easy to spot. Your code won't run, it'll probably terminate with an error and the software you are using to code (your IDE or Integrated Development Environment) will tell you whats wrong. The downside is that the error doesn't always make sense and are not always easy to find. Common examples of these sorts of errors in programming are forgetting to close brackets or speech marks, calling a variable name wrong (intVariable and intvariable are not the same thing) or calling something that doesn't exist (a library you forgot to include, a method you didn't make, etc.) There are many types of syntax errors that basically boil down to your code is just plain wrong.

Now logic errors are often much harder to spot. Your code works fine but you get the wrong output. Maybe you expect to get the number 5 but instead get 6 as the output. Logic errors are infinite in their potential as they can be almost anywhere in your code. Some common ones are running loops one too many or one too few times (using the <, >, <=, >= and = symbols incorrectly) which often results in a final output that is marginally different from what you expect, performing operations in the wrong order (remember BIDMAS?) or using the wrong variable type. Of note wrong variable types may also result in syntax errors (such as dividing 2 numbers and trying to store the result in an integer variable).

So how do you identify errors? Well syntax errors are often thrown at you with warnings saying your code doesn't work. Simply look at the error and work out what it says. Logic errors are more confusing and you'll want to look into how you debug code. Things like break points and stepping through code are your friend here. But I'm not going to explain them because of the most important things as a programming is to Google things when you don't know the answer. Often someone else had the same problem or even has a solution for your code. Learn from them.
1
reply
RoyalSheepy
Badges: 18
Rep:
?
#6
Report 1 year ago
#6
Moved to Webmaster, coding and software dev
1
reply
DayneD89
Badges: 21
Rep:
?
#7
Report 1 year ago
#7
What sort of errors are you getting? In general, it's just about making sure your code is correct, but there are a million different errors you can get. Start with something simple and once it works add complexity, testing along the way to ensure it all works as expected.

Something that helps me is writing my tests before any code, and then writing my code to pass the tests, though I suspect that this won't be of much help at the level you are coding at,
1
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Would you turn to a teacher if you were being bullied?

Yes (102)
24.06%
No (322)
75.94%

Watched Threads

View All