-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathled
More file actions
executable file
·36 lines (27 loc) · 930 Bytes
/
Copy pathled
File metadata and controls
executable file
·36 lines (27 loc) · 930 Bytes
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
#!/usr/bin/env python3
from sys import argv, exit
assert argv[1:], "Requires an integer as an input."
if argv[1].isdigit():
digits = argv[1]
else:
print("gimme digits, fucko")
exit(1)
leds = {"0": [" _ ", "| | ", "|_| "],
"1": [" ", "| ", "| "],
"2": [" _ ", " _| ", "|_ "],
"3": ["_ ", "_| ", "_| "],
"4": [" ", "|_| ", " | "],
"5": [" _ ", "|_ ", " _| "],
"6": [" _ ", "|_ ", "|_| "],
"7": ["_ ", " | ", " | "],
"8": [" _ ", "|_| ", "|_| "],
"9": [" _ ", "|_| ", " _| "]
}
def get_single_row(row_num: int) -> str:
"""
The LED characters are drawn to stdout one row at a time.
row_num indicates which row, 1, 2, or 3, to print.
:rtype: str
"""
return ''.join([leds[i][row_num] for i in list(digits)])
print("{}\n{}\n{}".format(get_single_row(0), get_single_row(1), get_single_row(2)))