Skip to content
Advertisement

TypeError: unsupported operand type(s) for /: ‘list’ and ‘int’ solution is an array

JavaScript
JavaScript

I solved an equation, the answer is an array. I am trying to use the answer for a new equation. I wrote a sample code to explain my problem!

Advertisement

Answer

I see you want to “use the answer for a new equation”.

The previous equation solution is a, a list with 1 element [1]

then you can use a[0] in your next equation

JavaScript

and p=a/2 is totally useless, you didn’t use p after that.

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