Hello everyone,
I’m a beginner with psychopy, with the coder more precisely.
I’m taking a course with a pdf support that should be done on psychopy 3.1.5. But this version does not launch on my computer.
So I decided to use version 2021.2.0. Now I am doing an exercise where I have to define variables with colon “:”.
An example of my very simple code:
v1 = list( range( 17))
print ( v1)
v2 = 1:16
print ( v2)
In the output, I have this message :
v2 = 1:16
^
SyntaxError: invalid syntax
Maybe the way to define variables has changed? I’ve already tried that code with older versions and this kind of assignment was not a problem.
Thank you for your help!
This may have been valid in Python2 but it isn’t in Python3 - which PsychoPy runs on. If you’re trying to do the same thing as that notation would in MATLAB, I think what you need is:
Hi,
Thank you for answering me!
I assigned v2 with the code you wrote and I got this answer
v2 = range(start=1, stop=16)
TypeError: range() does not take keyword arguments
Do you have another solution?
So the assignment with colon “:” worked python older versions but not in the new one? I tried to install psychopy 3.1.5 on two computers to have the same version as in the ebook course. But it seems that there is a incompatibility problem with the current version of python. I installed python 2.7 and psychopy 3.1.5 ( standalone windows) on one of the pc to see if they match. But psychopy just won’t run.
Thank you for your help!