This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Assigning a string variable on Visual Studio using python

I was using visual studio and the bash terminal, and I was getting syntax errors each time I was trying to assign a variable, e.g.:-

Hello World = "phrase"
Printf(Hello World)

Is there something about VS studio that means you have to work differently? It uses printf instead of print, but what else is different? What am I doing wrong?

It works fine in Python.org terminal, but not on visual studio?

python visual-studio

1 answer

Not sure what you are trying to do here. How are the two lines you wrote above connected? You can't have a space in python variable names, so Hello World is not a valid python variable.

You can assign the string to a variable, which you can then print.

phrase = "Hello World"
print(phrase)

It works fine in Python.org terminal

No it does not work in python.org terminal.
python
Valid python syntax will be required, no matter which terminal/program you use.

Log in to answer this question.