-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitmap.py
42 lines (39 loc) · 1.85 KB
/
bitmap.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
import sys
bitmap = """
....................................................................
************** * *** ** * ******************************
********************* ** ** * * ****************************** *
** ***************** ******************************
************* ** * **** ** ************** *
********* ******* **************** * *
******** *************************** *
* * **** *** *************** ****** ** *
**** * *************** *** *** *
****** ************* ** ** *
******** ************* * ** ***
******** ******** * *** ****
********* ****** * **** ** * **
********* ****** * * *** * *
****** ***** ** ***** *
***** **** * ********
***** **** *********
**** ** ******* *
*** * *
** * *
....................................................................
"""
print('Enter the message to display with the bitmap.')
message = input('>')
if message == '':
sys.exit()
# Loop over each line in the bitmap:
for line in bitmap.splitlines():
# Loop over each character in the line:
for i, bit in enumerate(line):
if bit == ' ':
# Print an empty space since there's a space in the bitmap:
print(' ', end='')
else:
# print a character from the message:
print(message[i % len(message)], end='')
print()