VERY simple question from a complete newbie.


So, I'm a complete newbie to coding. My experience so far is about 2 weeks doing Python in Code Academy. I downloaded Pycharm recently, and for the most part, anything that I do in code academy can be transferred directly over, and it works, save for this ONE thing. Please forgive me for not indenting. 

num = 1

while num < 11:
print num**2
num += 1

Pycharm seems to hate this, and throws the error "unsupported operand type(s) for ** or pow(): 'NoneType' and 'int'"

Now, from what I've gathered, it doesn't like the fact that I'm trying to add a word to an integer, essentially, right? It throws the same error when I do anything else like that as well, for example:

variable = 10

print variable + 2

I've tried telling Pycharm that the number is an integer, but no matter how I try to code it, it doesn't seem to want to work. 

Any help on this would be very greatly appreciated!

Comment actions Permalink

Do you know which version of Python is in use by PyCharm? Take a look at Preferences -> Project -> Project Interpreter

Comment actions Permalink

My guess is he loaded the latest and need some parentheses around the print statement.  There's a lot of documentation our there that supports older versions. 



Please sign in to leave a comment.