Guest User

Untitled

a guest
Jul 12th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def lista_nombres():
  2. nombres = []
  3. ok = False
  4. repeticiones = 0
  5. while ok == False:
  6. x = input("Ingresa un nombre o 0 para terminar: ")
  7. if x == "0":
  8. ok == True
  9. break
  10. if x in nombres:
  11. print("El nombre ya está en la lista.")
  12. repeticiones = repeticiones + 1
  13. nombres.append(x)
  14.  
  15. return nombres, repeticiones
  16.  
  17. nombres, repeticiones = lista_nombres()
  18. print("La lista es: ", nombres)
  19. print( repeticiones/len(nombres))
  20. print(repeticiones)
  21.  
  22. def lista_nombres():
  23. return ("Valor1", "Valor2")
  24.  
  25. v1, v2 = lista_nombres()
  26.  
  27. v1, _ = lista_nombres()
Add Comment
Please, Sign In to add comment