-
Notifications
You must be signed in to change notification settings - Fork 0
/
bigdigits.py
executable file
·46 lines (41 loc) · 1.47 KB
/
bigdigits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/python3
#This is my first (almost) robust python program
import sys
Zero = [" *** ", " * * ", " * * ", " * * ", " * * ",
" * * ", " *** "]
One = [" * ", " ** ", " * * ", " * ", " * ",
" * ", " ***** "]
Two = [" *** ", " * * ", " * * ", " * ", " * ",
" * ", " ***** "]
Three = [" **** ", " * ", " * ", " **** ", " * ",
" * ", " **** "]
Four = [" * ", " ** ", " * * ", " * * ", " ****** ",
" * ", " * "]
Five = [" ***** ", " * ", " * ", " ***** ", " * ",
" * ", " ***** "]
Six = [" * ", " * ", " * ", " ***** ", " * * ",
" * * ", " ***** "]
Seven = [" ******* ", " * ", " * ", " * ", " * ",
" * ", " * "]
Eigth = [" *** ", " * * ", " * * ", " ***** ", " * * ",
" * * ", " *** "]
Nine = [" ***** ", " * * ", " * * ", " ***** ", " * ",
" * ", " * "]
Digits = [Zero, One, Two, Three, Four, Five, Six, Seven, Eigth, Nine]
try:
digits = sys.argv[1]
row = 0
while row < 7:
line = ""
column = 0
while column < len(digits):
number = int(digits[column])
digit = Digits[number]
line += digit[row] + " "
column += 1
print(line)
row += 1
except IndexError:
print("Usage: bigdigits.py <number>\n")
except ValueError as err:
print(err, "in", digits)