This is what I need to do for the program to show the percentage of votes, but if I start the variable with zero it does not, because the program says that division by zero does not, but if I start with 1, It's going to go wrong, can someone give me a light? the program shows how many votes a given operating system had and the percentage over the total.
listaWindows = []
listaUNIX = []
listaLinux = []
listaNetware = []
listaMacos = []
listaOutro = []
contW = contU = contL = contN = contM = contO = porcenW = porcenU = porcenL = porcenN = porcenM = porcenO = 0
soma = 1
while True:
print('''
1 - Windows Server
2 - UNIX
3 - Linux
4 - Netware
5 - Mac OS
6 - Outro''')
opcao = int(input("Informe a opção desejada: "))
if opcao == 0:
break
while opcao > 6 or opcao < 1:
opcao = int(input("Opção invalida, digite a opção novamente: "))
if opcao == 1:
listaWindows.append(contW)
contW += 1
porcenW = (contW / soma) * 100
if opcao == 2:
listaUNIX.append(contU)
contU += 1
porcenU = (contU / soma) * 100
if opcao == 3:
listaLinux.append(contL)
contL += 1
porcenL = (contL / soma) * 100
if opcao == 4:
listaNetware.append(contN)
contN += 1
porcenN = (contN / soma) * 100
if opcao == 5:
listaMacos.append(contM)
contM += 1
porcenM = (contM / soma) * 100
if opcao == 6:
listaOutro.append(contO)
contO += 1
porcenO = (contO / soma) * 100
soma = contW + contU + contL + contN + contM + contO
print(f'''
Votos %
Windows: {contW} {porcenW:.2f}
UNIX: {contU} {porcenU:.2f}
Linux: {contL} {porcenL:.2f}
Netware: {contN} {porcenN:.2f}
Mac {contM} {porcenM:.2f}
Outro {contO} {porcenO:.2f}''')