-1

I currently have this code written to declare 10 variables in python:

oneScore = textFont.render('1.   ' + str(sortedList[0][0]) + '   ' + str(sortedList[0][1]), True, white)
twoScore = textFont.render('2.   ' + str(sortedList[1][0]) + '   ' + str(sortedList[1][1]), True, white)
threeScore = textFont.render('3.   ' + str(sortedList[2][0]) + '   ' + str(sortedList[2][1]), True, white)
fourScore = textFont.render('4.   ' + str(sortedList[3][0]) + '   ' + str(sortedList[3][1]), True, white)
fiveScore = textFont.render('5.   ' + str(sortedList[4][0]) + '   ' + str(sortedList[4][1]), True, white)
sixScore = textFont.render('6.   ' + str(sortedList[5][0]) + '   ' + str(sortedList[5][1]), True, white)
sevenScore = textFont.render('7.   ' + str(sortedList[6][0]) + '   ' + str(sortedList[6][1]), True, white)
eightScore = textFont.render('8.   ' + str(sortedList[7][0]) + '   ' + str(sortedList[7][1]), True, white)
nineScore = textFont.render('9.   ' + str(sortedList[8][0]) + '   ' + str(sortedList[8][1]), True, white)
tenScore = textFont.render('10.   ' + str(sortedList[9][0]) + '   ' + str(sortedList[9][1]), True, white)

Is there a more efficient way of doing this?

Callum
  • 65
  • 1
  • 3
  • 9

1 Answers1

1

Not with named variables. That's what lists are for

score[i] = textFont.render('1.   ' + str(sortedList[i][0]) + '   ' + str(sortedList[i][1]), True, white)
blue_note
  • 27,712
  • 9
  • 72
  • 90