0
judges = ["judge 1", "judge 2", "judge 3", "judge 4", "judge 5",]
couples = [1, 2, 3, 4, 5]

x=0
j=0
done = False
def judging(j, x, judges, couples,):
  couplescores1 = []
  couplescores2 = []
  couplescores3 = []
  couplescores4 = []
  couplescores5 = []
  print ("scoreing couple",couples[j],)
  for i in couples:
    print("score couples" ,couples[j],judges[x],"out of 30 minimum 1")
    score = int(input( ": "))
    couplescores[j].append(score)


    x=x+1
  j=j+1
  if j == 5:
    done = True
  else:
    x = 0
    judging(j, x, judges, couples,)
judging(j, x, judges, couples,)

so that is my code and what i need help with is the append what i want is for the [j] in it to be counted as its integer so that the first time round it saves score into couplescores1 then without needing extra long code next round couplescores2 and ect i do know i an use if and elif statments for example

    if j == 0:
       couplescores1.append(score)
    elif j == 1:
       couplescores2.append(score)

ect but i want to avoid it if i can thank you

1 Answers1

0

I am not sure what you wanted completely, however I think I know what you are trying to do. I added a list that holds the scores for the couples from 1-5 called couplescores. I then add the score of that couple to the corresponding place in the list, and at then at the end print it.

judges = ["judge 1", "judge 2", "judge 3", "judge 4", "judge 5",]
couples = [1, 2, 3, 4, 5]
couplescores = [0,0,0,0,0] # Holds scores for the couples 1-5

x=0
j=0
done = False
def judging(j, x, judges, couples,):

    print ("Scoring couple",couples[j],)
    for i in couples:
        print("Score couples" ,couples[j],judges[x],"out of 30 minimum 1")
        score = int(input(": "))
        couplescores[j] = couplescores[j] + score # Adds the score to the list


        x=x+1

    j=j+1
    if j == 5:
        done = True
    else:
        x = 0
        judging(j, x, judges, couples)

judging(j, x, judges, couples)
print(couplescores) # Prints scores
Imaad F
  • 128
  • 8