jeudi 5 mars 2020

IF, ELIF, ELSE functions not working in my code

x = int(input("Numbers of Voters:"))
a = input("Candidate 1:")
b = input("Candidate 2:")
c = input("Candidate 3:")

for i in range(x):
    print ("Enter Your 1st choice ")
    for a in range(1):
        a= input("1st Choice: ")
for i in range(x):
    print ("Enter your 2nd choice ")
    for b in range(1):
        b= input("2nd Choice: ")
for i in range(x):
    print ("Enter your 3rd choice ")
    for c in range(1):
        c= input("3rd Choice: ")

if (a > b) and (a > c):
  print("Winner is", a)
elif (b > a) and (b > c):
  print("Winner is", b)
else (c > a) and (c > b):
  print("Winner is", c)

this is my code, and its not working, my assignment is to ask the number of voter and they all have to rank for best to least. There is gonna be 3 candidates that enters first and at the end the one who came first is supposed to win but nothing is working properly, if someone could help me😱

Aucun commentaire:

Enregistrer un commentaire