-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASCII_solved.txt
More file actions
32 lines (24 loc) · 2.98 KB
/
ASCII_solved.txt
File metadata and controls
32 lines (24 loc) · 2.98 KB
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
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
length = int(raw_input())
height = int(raw_input())
text = raw_input()
text2 = "Lorem ipsum dolor sit amet,..." # Dit is voor hardcoded checks
text_lowcase =text.lower() # Maakt van alle uppercases een lowercase
list_of_rows = [] # Een lijst waar de rijen met ASCII-code in komen, elke rij weer als een lijst van de elementen zelf
list_of_chars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "?"]
adjusted_text = "" # create an empty string
for letter in text_lowcase:
adjusted_text += "?" if letter not in list_of_chars else letter # replace all chars that are not known for "?"
text_to_print ="".join(adjusted_text) #hier maak ik er weer gewone tekst van
for i in xrange(height):
row = raw_input()
row_number = [row[i:i+length] for i in xrange(0, len(row), length)] # Maakt een lijst waarin de elementen lengte 'lenght' hebben
row_as_dictionary = dict(zip(list_of_chars, row_number)) # Hier link ik de lijsten met ASCII-code aan de lijst met letters om een dictionary te vormen
list_of_rows.append(row_as_dictionary) # Voegt die lijst toe aan mijn lijst met lijsten (aantal lijsten = height)
for row_as_dictionary in list_of_rows:
ASCII_row_list = [row_as_dictionary.get(letter) for letter in text_to_print]
ASCII_row = "".join(ASCII_row_list)
print ASCII_row