The error data type means that the program is expecting a specific type of data ( number, list, matrix, real, complex, string, etc.) while you are feeding it some other type of data. The point in the program where you are taken when the error occurs is where the exception was launched.
A common source of error stems from the use of variables that are global and defined in some other program. You can use the same name inside your program as long as you declare the variable local.
If your program is in fact a function, then all its argument must be passed in the call to the function: You cannot ask a function to read your input.
I will not pretend to know why you get the error, but the few comments I made above may help you debug the program.
By the way, if you are interested a Cobebrook online calculator,
here is a link