Perhaps the following code can give you some ideas and insights? Try replacing your if block with it.
Code:
print type(defn), type(att)
att = int(att)
defn = int(defn)
print type(defn), type(att)
if defn < att: print 3
elif defn <= att*2: print 4
else: print 5
If it doesn't make sense to you, tell me what you've been thinking about when trying to use and modify this code, and I'll explain it to you in more detail.
One problem is that you're comparing strings instead of ints. In python, strings are compared alphabetically, so "10" comes before "2", because the character "1" comes before the character "2". The numbers, as characters, occur in their natural order. See also asciitable.com, or ascii(1).
Also, you may want to do
Code:
try: att = raw_input("blah: ")
except EOFError: break
That way, when someone hits ^D your program exits normally instead of with an error message, which is good form on *nix [try ^D-closing cat, grep, sed, ...].
Also also, you don't have to tell the user that your program terminated; he can tell by his shell prompt appearing again. Compare with cat and others again
Also also also, try:
Code:
print 5 - (defn <= 2*att) - (defn < att)
Here's the explanation of the magic:
Code:
print int(defn <= 2*att), int(defn < att)