Skip to main content

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

Awaiting user input

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • 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, 
    Jaromił

    0

Post is closed for comments.