Jan-12-2023, 11:24 AM
Hi all,
I am new to Python. I am doing an application. the application takes 20 names of individuals then prompts user to input out of 20 individual who came first, second, third..... twentieth.
According to the ranking then points allocated for every individual for the first place 100, second 95, third 90... so on.
However, I am finding to very difficult to allocate the points as not sure how to find out who came first and second. The code is below.
Any help will be apricated.
I am new to Python. I am doing an application. the application takes 20 names of individuals then prompts user to input out of 20 individual who came first, second, third..... twentieth.
According to the ranking then points allocated for every individual for the first place 100, second 95, third 90... so on.
However, I am finding to very difficult to allocate the points as not sure how to find out who came first and second. The code is below.
Any help will be apricated.
names=[] history=[] maths=[] for i in range(0,20): nam=input("Please enter the name of competitor ") names.append(nam) order=["first","second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelfth", "thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth","twentieth"] for i in range (0,20): print("Please enter the name of the individual who came ",order[i],"in History Quiz ") a=input() history.append(a) for i in range (0,20): print("Please enter the name of the individual who came ",order[i],"in Maths Quiz ") a=input() maths.append(a) if names[0]==history[0]: print(names[0]) elif names[1]==history[0]: print(names[1]) elif names[2]==history[0]: print(names[2]) elif names[3]==history[0]: print(names[3]) elif names[4]==history[0]: print(names[4]) elif names[5]==history[0]: print(names[5]) elif names[6]==history[0]: print(names[6]) elif names[7]==history[0]: print(names[7]) elif names[8]==history[0]: print(names[8]) elif names[9]==history[0]: print(names[9]) elif names[10]==history[0]: print(names[10]) elif names[11]==history[0]: print(names[11]) elif names[12]==history[0]: print(names[12]) elif names[13]==history[0]: print(names[13]) elif names[14]==history[0]: print(names[14]) elif names[15]==history[0]: print(names[15]) elif names[16]==history[0]: print(names[16]) elif names[17]==history[0]: print(names[17]) elif names[18]==history[0]: print(names[18]) else: print(names[19]) if names[0]==maths[0]: print(names[0]) elif names[1]==maths[0]: print(names[1]) elif names[2]==maths[0]: print(names[2]) elif names[3]==maths[0]: print(names[3]) elif names[4]==maths[0]: print(names[4]) elif names[5]==maths[0]: print(names[5]) elif names[6]==maths[0]: print(names[6]) elif names[7]==maths[0]: print(names[7]) elif names[8]==maths[0]: print(names[8]) elif names[9]==maths[0]: print(names[9]) elif names[10]==maths[0]: print(names[10]) elif names[11]==maths[0]: print(names[11]) elif names[12]==maths[0]: print(names[12]) elif names[13]==maths[0]: print(names[13]) elif names[14]==maths[0]: print(names[14]) elif names[15]==maths[0]: print(names[15]) elif names[16]==maths[0]: print(names[16]) elif names[17]==maths[0]: print(names[17]) elif names[18]==maths[0]: print(names[18]) else: print(names[19])