I have a bit of question with python.
I have a piece of code
screen.blit(badninja1,(badninja1px ,badninja1py))
screen.blit(badninja2,(badninja2px ,badninja2py))
screen.blit(badninja3,(badninja3px ,badninja3py))
I know it repeats 3 time and I want to do some refactoring.
That is a piece of python code what it does was draw badninja1 at location badninja1px and badninja1py etc. bandninja1, badninja1px, badninja1py and other are variable names.
I wanted to put this code in a for loop
for x in range(1, 4):
#add number 1, 2, 3 to the variable name.
I tried to do that and realized that I can combine string easily in python:
"Dec "+str(25)+"th".
However, changing variable name is a bit tricky.
Can anybody give ma a hint thanks!!