SimeonTs

SUPyF2 D.Types and Vars Exercise - 06. Triples of Latin Lett

Sep 27th, 2019
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. """
  2. Data Types and Variables - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1722#5
  4.  
  5. SUPyF2 D.Types and Vars Exercise - 06. Triples of Latin Letters
  6. Problem:
  7. Write a program to read an integer n and print all triples of the first n small Latin letters, ordered alphabetically:
  8. Examples:
  9. Input:
  10. 3
  11. Output:
  12. aaa
  13. aab
  14. aac
  15. aba
  16. abb
  17. abc
  18. aca
  19. acb
  20. acc
  21. baa
  22. bab
  23. bac
  24. bba
  25. bbb
  26. bbc
  27. bca
  28. bcb
  29. bcc
  30. caa
  31. cab
  32. cac
  33. cba
  34. cbb
  35. cbc
  36. cca
  37. ccb
  38. ccc
  39. """
  40. num = int(input())
  41. for a in range(num):
  42.     for b in range(num):
  43.         for c in range(num):
  44.             print(f"{chr(97 + a)}{chr(97 + b)}{chr(97 + c)}")
Add Comment
Please, Sign In to add comment