Anyone Having problems with the vex v5 python?

I am using python in the text code option and i am running this command “def print(How are you doing?)”. Then I click Build but it says that “are” is a invalid syntax.

So that’s invalid Python.

3 Likes

This code is not valid Python. I would suggest watching a tutorial like this one here https://www.youtube.com/watch?v=b093aqAZiPU to get a grasp on how to program in python

1 Like

As others have said, the syntax is incorrect. To use the print function, don’t put the “def” in front of it. That is used to define you own function. To print text, use this:

print("whatever text you want")

Make sure you yse the double quotation marks because that diffrentiates the text inside the parantheses from a varible (without the quotes) and normak text (with the quotes)

I hope this wouks!

2 Likes

Just some extra python clarification:

def is used to define a function. E.g. if you wanted to define myfunc with parameters/arguments a, b, c, etc, you would use def:

def myfunc(a, b, c):
  pass

You don’t need quotation marks when you are showing args, but when you want to pass a string to the function, that’s when you use quotation marks.

Also, after you run the code, you might not directly see the output on the Brain because that requires brain.screen.print(“how are you doing?”).

Addition to BananaPi's words

Single quotation marks also work, but yes.

2 Likes

You should try using C++, if you are comfortable with that of course, also the reason why it is invalid is probably because you forgot to use quotations around the phrase.
Also if word coding is too hard for you right now try using block code for the time being until you can grasp the idea of word code.