Basicly I've been trying to make this word generator, which displays your input in a big font in the console. I'm trying to take the user's input, then put each char individually in a list. So now the first item in the list is 'a' for example (with the input being 'apple' for example). Now there's a list I made called a. I want to print that list by the user's input (a). How do I do so? This is my code:
a = ["@@@@@",
("@ @"),
("@ @"),
("@@@@@"),
("@ @"),
("@ @"),
("@ @")]
b = ["@@@@ ",
("@ @"),
("@ @"),
("@@@@ "),
("@ @"),
("@ @"),
("@@@@ ")]
c = ["@@@@@",
("@ "),
("@ "),
("@ "),
("@ "),
("@ "),
("@@@@@")]
d = ["@@@@ ",
("@ @"),
("@ @"),
("@ @"),
("@ @"),
("@ @"),
("@@@@ ")]
e = ["@@@@@",
("@ "),
("@ "),
("@@@@@"),
("@ "),
("@ "),
("@@@@@")]
f = ["@@@@@",
("@ "),
("@ "),
("@@@@@"),
("@ "),
("@ "),
("@ ")]
g = ["@@@@@",
("@ "),
("@ "),
("@ @@@"),
("@ @"),
("@ @"),
("@@@@@")]
h = ["@ @",
("@ @"),
("@ @"),
("@@@@@"),
("@ @"),
("@ @"),
("@ @")]
i = ["@@@@@",
(" @ "),
(" @ "),
(" @ "),
(" @ "),
(" @ "),
("@@@@@")]
j = [" @",
(" @"),
(" @"),
(" @"),
(" @"),
("@ @"),
(" @@@ ")]
k = ["@ @",
("@ @ "),
("@ @ "),
("@@ "),
("@ @ "),
("@ @ "),
("@ @")]
l = ["@ ",
("@ "),
("@ "),
("@ "),
("@ "),
("@ "),
("@@@@@")]
m = ["@ @",
("@@ @@"),
("@ @ @"),
("@ @ @"),
("@ @"),
("@ @"),
("@ @")]
word = []
input_word = input("Which word would you like to display?")
for i in input_word:
word.append(i)
Create a dictionary that maps each letter to the corresponding list:
letter_map = {'a': a, 'b': b, 'c': c, ...}
in = input("What letter?")
print(letter_map[in[0]])
word
contains the word
letters = {'a': ["@@@@@", "@ @", "@ @", "@@@@@", "@ @", "@ @", "@ @"], ...}
range(7)
using for
: for row in range(7):
for letter in word:
outword += " " + letters[letter][row]
That should get you started. Feel free to try and post your results. We can help you once you have some code.
print('\\n'.join([' '.join([{'a': ["@@@@@", "@ @", "@ @", "@@@@@", "@ @", "@ @", "@ @"] , 'b': ["@@@@ ", "@ @", "@ @", "@@@@ ", "@ @", "@ @", "@@@@ "] , 'c': ["@@@@@", "@ ", "@ ", "@ ", "@ ", "@ ", "@@@@@"] , 'd': ["@@@@ ", "@ @", "@ @", "@ @", "@ @", "@ @", "@@@@ "] , 'e': ["@@@@@", "@ ", "@ ", "@@@@@", "@ ", "@ ", "@@@@@"] , 'f': ["@@@@@", "@ ", "@ ", "@@@@@", "@ ", "@ ", "@ "] , 'g': ["@@@@@", "@ ", "@ ", "@ @@@", "@ @", "@ @", "@@@@@"] , 'h': ["@ @", "@ @", "@ @", "@@@@@", "@ @", "@ @", "@ @"] , 'i': ["@@@@@", " @ ", " @ ", " @ ", " @ ", " @ ", "@@@@@"] , 'j': [" @", " @", " @", " @", " @", "@ @", " @@@ "] , 'k': ["@ @", "@ @ ", "@ @ ", "@@ ", "@ @ ", "@ @ ", "@ @"] , 'l': ["@ ", "@ ", "@ ", "@ ", "@ ", "@ ", "@@@@@"] , 'm': ["@ @", "@@ @@", "@ @ @", "@ @ @", "@ @", "@ @", "@ @"]}[l][i] for l in "abcdefghijklm"]) for i in range(7)]))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.