Skip to content
Advertisement

Unsupported operand types ‘NoneType’

I am very new to Python, and I’m trying to create a software that calculates a series of equations and I keep running into an error.

This is the code:

JavaScript

My goal is that the code runs these equations until v_i equals 0, while populating the lists with the relevant results, then throwing all the information into a graph once the while loop is done.

However, after inserting m and v_i, I get an error that says:

JavaScript

I’m a bit stuck at the moment and I can’t seem to figure out how to fix this error.

Advertisement

Answer

This line:

JavaScript

You are appending a value to C, and then using the / operator on the append() call.

list.append() returns None, hence the error. Try this instead:

JavaScript

P.S. PEP-8 is recommended:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement