Hello @Halimah_Alalawi
It remains unclear where your code fails. It looks ok. How do you assign a participant number?
PsychoPy defaults to f"{randint(0, 999999):06.0f}"but you can simply delete this command in Experiment settings, replace it with something that suits your needs or leave it empty. If you want consecutive participant numbers you might want to take a look at the vespr-portal by @wakecarter
Or you could use the shelf to assign list_numbers and card_indices.
Best wishes Jens