Skip to main content

Object type changing to string after being declared as a continuous variable?

Awaiting user input


1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Could you try to isolate the error and produce a minimal working example? It is not possible to reproduce the error with the code snippet you provided.

    When I test print(type(X)) in another cell, it says X is not defined, but when I test print(type('X'), it says X is a string. 

    The error \(\texttt{X is not defined}\) says that in the current cell, the object \(\texttt{X}\) is not known in the given scope. \(\texttt{print(type('X'))}\) works because \(\texttt{'X'}\) is literally a \(\texttt{string}\). Through the use of \(\texttt{''}\), you turned \(\texttt{X}\) into the \(\texttt{string}\) which holds the capital letter \(\texttt{X}\).

    Best regards, 


Please sign in to leave a comment.