fork(1) download
  1. #!/usr/bin/env python3
  2. # Copyright (c) 2008 Qtrac Ltd. All rights reserved.
  3. # This program or module is free software: you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License as published
  5. # by the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version. It is provided for educational
  7. # purposes and is distributed in the hope that it will be useful, but
  8. # WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. # General Public License for more details.
  11.  
  12. import sys
  13.  
  14.  
  15. Zero = [" *** ",
  16. " * * ",
  17. "* *",
  18. "* *",
  19. "* *",
  20. " * * ",
  21. " *** "]
  22. One = [" * ", "** ", " * ", " * ", " * ", " * ", "***"]
  23. Two = [" *** ", "* *", "* * ", " * ", " * ", "* ", "*****"]
  24. Three = [" *** ", "* *", " *", " ** ", " *", "* *", " *** "]
  25. Four = [" * ", " ** ", " * * ", "* * ", "******", " * ",
  26. " * "]
  27. Five = ["*****", "* ", "* ", " *** ", " *", "* *", " *** "]
  28. Six = [" *** ", "* ", "* ", "**** ", "* *", "* *", " *** "]
  29. Seven = ["*****", " *", " * ", " * ", " * ", "* ", "* "]
  30. Eight = [" *** ", "* *", "* *", " *** ", "* *", "* *", " *** "]
  31. Nine = [" ****", "* *", "* *", " ****", " *", " *", " *"]
  32.  
  33. Digits = [Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine]
  34.  
  35. try:
  36. digits = sys.argv[1]
  37. row = 0
  38. while row < 7:
  39. line = ""
  40. column = 0
  41. while column < len(digits):
  42. number = int(digits(column))
  43. digit = Digits[number]
  44. line += digit[row] + " "
  45. column += 1
  46. print(line)
  47. row += 1
  48. except IndexError:
  49. print("usage: bigdigits.py <number>")
  50. except ValueError as err:
  51. print(err, "in", digits)
  52.  
Success #stdin #stdout 0.02s 8736KB
stdin
bigdigits.py, 1
stdout
usage: bigdigits.py <number>