You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 line
911 B

5 年之前
  1. #!/usr/bin/env python3
  2. #title :8-5.py
  3. #description :Opdracht 8.5 - Dict & functions
  4. #author :Marcel Haazen
  5. #email :marcel@haazen.xyz
  6. #date :04-11-2019 - 10:10
  7. #version :0.1
  8. #usage :python3 8-5.py
  9. #notes :
  10. #python_version :3.7.3
  11. #==============================================================================
  12. def namen():
  13. namen = {}
  14. while True:
  15. naam = str(input("Volgende naam: "))
  16. if naam == "":
  17. for name in namen.keys():
  18. if namen[name] == 1:
  19. print("Er is", namen[name], "student met de naam", name)
  20. else:
  21. print("Er zijn", namen[name], "studenten met de naam", name)
  22. break
  23. else:
  24. if naam in namen.keys():
  25. namen[naam] = namen[naam]+1
  26. else:
  27. namen[naam] = 1
  28. namen()