Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Qual o melhor Sistema Operacional para o uso?\n")
- print("As possiveis respostas sao: \n")
- print("1- Windows XP\n2- Unix\n3- Linux\n4- Netware\n5- Mac Os\n6- Outro\nDigite 0 para sair\n")
- votos = [1] #lista no empty
- champs = 0 #recebe o número indice do campeão
- campeao = 'nenhum' #recebe o nome do campeão
- while votos[len(votos)-1] != 0:
- voto = int(input("Informe o seu voto: "))
- votos.append(voto)
- #Remove o item '0' da lista na posição dada e o devolve.
- votos.pop(0)
- votos.pop(len(votos)-1)
- votosWin = votos.count(1)
- votosUni = votos.count(2)
- votosLin = votos.count(3)
- votosNet = votos.count(4)
- votosMac = votos.count(5)
- votosOut = votos.count(6)
- total = votosWin + votosUni + votosLin + votosNet + votosMac + votosOut
- for i in range(1, 7):
- for x in range(1, 7):
- if votos.count(i) > votos.count(x):
- champs = i
- if champs == 1:
- campeao = "Windows XP 1500"
- elif champs == 2:
- campeao = "Unix 3500"
- elif champs == 3:
- campeao = "Linux 3000"
- elif champs == 4:
- campeao = "Netware 500"
- elif champs == 5:
- campeao = "Mac Os 150"
- elif champs == 6:
- campeao = "Outro 150"
- porcWin = (float(votosWin)/(len(votos)))*100
- porcUni = (float(votosUni)/(len(votos)))*100
- porcLin = (float(votosLin)/(len(votos)))*100
- porcNet = (float(votosNet)/(len(votos)))*100
- porcMac = (float(votosMac)/(len(votos)))*100
- porcOut = (float(votosOut)/(len(votos)))*100
- print("\n\nSistema Operacional - Votos %")
- print("Windows XP 1500", porcWin,"%")
- print("Unix 3500", porcUni,"%")
- print("Linux 3000", porcLin,"%")
- print("Netware 500", porcNet,"%")
- print("Mac Os 150", porcMac,"%")
- print("Outro 150", porcOut,"%")
- print("\n\n")
- print("Total de", total,"votos")
- print("O Sistema Operacional mais votado foi o:", campeao, "com", votosWin, "votos", "correspondendo a", porcWin,"% dos votos." )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement