Reputation: 697
from pip.backwardcompat import raw_input
from PFD import *
def getInput():
try:
n = raw_input("Please enter the file size: ")
int(n)
print(str(n))
order = raw_input("Please enter a Fib Order [3/4]: ")
int(order)
except ValueError:
getInput()
if order == 3:
Fib.three(n)
elif order == 4:
Fib.four(n)
else:
print("You did something wrong, idiot.")
getInput()
getInput();
So this is the problem. No matter what I do, it tells me I did something wrong and calls me an idiot. :(
Upvotes: 0
Views: 251
Reputation: 59974
In python, integers are immutable. Hence, when you do int(n)
, it won't change the type of the variable in-place. You have to do n = int(n)
, or wrap int()
around the raw_input(...
call.
This is the same for order
Upvotes: 2
Reputation: 2821
Your line
int(order)
needs to be assigned back to the order variable like so:
order = int(order)
edit: As alKid pointed out, the same for n:
n = int(n)
Upvotes: 6