You are calling a method on the wrong type of object
Attribute Error
My code isn't working :-(
What type of error do you get? Start here...
yes
A variable that should I'm trying to print a value contain a value does not but getting a weirdYou are storing the return looking string value of a function which You are printing an object changes the variable (e.g. a FileObject) when itself (e.g. sort) you want the result of calling a method on the A number which should object be a fraction is coming out as zero in Python 2 A regular expression is You are dividing integers not matching when I rather than oats. expect it to Convert the numbers to You have forgotten to use oats or from __future__ raw strings or escape import division backslash characters
SyntaxError
You've forgotten the quotes around a string You have forgotten to put a colon at the end of a def/if/for line You have different number of open and close brackets in a statement
NameError
You've misspelt a variable, function or method name You've forgotten to import a module You've forgotten to dene a variable Your code uses a variable outside the scope where it's dened Your code calls a function before it's dened You're trying to print a single word and have forgotten the quotes
Do you get an error when you run the code?
no
TypeError
You're trying to use an operator on the wrong type of objects An object which you expect to have a value is actually None You've used non-integer numbers in a list slice You've called a method/ function with the wrong number or type of arguments
I am reading a le but getting no input You have already read the contents of the le earlier in the code, so the cursor is at the end.
Does the code use loops or if statements?
if
Two numbers which should be equal are not You are comparing a number with a string representation of a number (e.g. if 3 == "3") A complex condition is not giving the expected result The order of precedence in the condition is ambiguous - add some parentheses
neither loops
A list which should have a value for every iteration only has a single value You have dened the list inside the loop: move it outside A loop which uses the range function misses out the last value The range function is exclusive at the nish: increase it by one. I am trying to loop over a collection of strings, but am getting individual characters You are iterating over a string by mistake I am trying to write multiple lines to a le but only getting a single one You have opened the le inside the loop: move it outside
Indentation Error
You've used a mixture of tabs and spaces You haven't indented all lines in a block equally
You're trying to open a le that doesn't exist
IOError
You're trying to look up a key that doesn't exist in a dict
KeyError
http://pythonforbiologists.com
also check...