I need to write a code for printing my name as below by taking the user input for a name. I need to use for and if statements.
Here is an A-Z list of the letters A-Z. I know how to do the input code but I am unsure of how to actually loop it using 'for' and 'if' statements. I have tried to google search for help but nothing has helped. I have already asked this question but have changed my initial work. The code keeps saying syntax error.
# print A to Z in python for Q7
print("..######..\n..#....#..\n..######..\n..#....#..\n..#....#..\n\n")
print("..######..\n..#....#..\n..#####...\n..#....#..\n..######..\n\n")
print("..######..\n..#.......\n..#.......\n..#.......\n..######..\n\n")
print("..#####...\n..#....#..\n..#....#..\n..#....#..\n..#####...\n\n")
print("..######..\n..#.......\n..#####...\n..#.......\n..######..\n\n")
print("..######..\n..#.......\n..#####...\n..#.......\n..#.......\n\n")
print("..######..\n..#.......\n..#####...\n..#....#..\n..#####...\n\n")
print("..#....#..\n..#....#..\n..######..\n..#....#..\n..#....#..\n\n")
print("..######..\n....##....\n....##....\n....##....\n..######..\n\n")
print("..######..\n....##....\n....##....\n..#.##....\n..####....\n\n")
print("..#...#...\n..#..#....\n..##......\n..#..#....\n..#...#...\n\n")
print("..#.......\n..#.......\n..#.......\n..#.......\n..######..\n\n")
print("..#....#..\n..##..##..\n..#.##.#..\n..#....#..\n..#....#..\n\n")
print("..#....#..\n..##...#..\n..#.#..#..\n..#..#.#..\n..#...##..\n\n")
print("..######..\n..#....#..\n..#....#..\n..#....#..\n..######..\n\n")
print("..######..\n..#....#..\n..######..\n..#.......\n..#.......\n\n")
print("..######..\n..#....#..\n..#.#..#..\n..#..#.#..\n..######..\n\n")
print("..######..\n..#....#..\n..#.##...\n..#...#...\n..#....#..\n\n")
print("..######..\n..#.......\n..######..\n.......#..\n..######..\n\n")
print("..######..\n....##....\n....##....\n....##....\n....##....\n\n")
print("..#....#..\n..#....#..\n..#....#..\n..#....#..\n..######..\n\n")
print("..#....#..\n..#....#..\n..#....#..\n...#..#...\n....##....\n\n")
print("..#....#..\n..#....#..\n..#.##.#..\n..##..##..\n..#....#..\n\n")
print("..#....#..\n...#..#...\n....##....\n...#..#...\n..#....#..\n\n")
print("..#....#..\n...#..#...\n....##....\n....##....\n....##....\n\n")
print("..######..\n......#...\n.....#....\n....#.....\n..######..\n\n")
For example, entering the name seymour would produce this output:
seymour
..######..
..#.......
..######..
.......#..
..######..
..######..
..#.......
..#####...
..#.......
..######..
..#....#..
...#..#...
....##....
....##....
....##....
..#....#..
..##..##..
..#.##.#..
..#....#..
..#....#..
..######..
..#....#..
..#....#..
..#....#..
..######..
..#....#..
..#....#..
..#....#..
..#....#..
..######..
..######..
..#....#..
..#.##...
..#...#...
..#....#..
I have tried to use 'while' and 'if' statements using the code but it keeps saying syntax error. Below is my code so far.
name= input('Enter name: ')
i=0
while i<0 len(name):s
if i== 'A' or 'a' then print("..######..\n..#....#..\n..######..\n..#....#..\n..#....#..\n\n")
if S[i]= 'B' or 'b' then print("..######..\n..#....#..\n..#####...\n..#....#..\n..######..\n\n")
if S[i]= 'C' or 'c' then print("..######..\n..#.......\n..#.......\n..#.......\n..######..\n\n")
if S[i]= 'D' or 'd' then print("..#####...\n..#....#..\n..#....#..\n..#....#..\n..#####...\n\n")
if S[i]= 'E' or 'e' then print("..######..\n..#.......\n..#####...\n..#.......\n..######..\n\n")
if S[i]= 'F' or 'f' then print("..######..\n..#.......\n..#####...\n..#.......\n..#.......\n\n")
if S[i]= 'G' or 'g' then print("..######..\n..#.......\n..#####...\n..#....#..\n..#####...\n\n")
if S[i]= 'H' or 'h' then print("..#....#..\n..#....#..\n..######..\n..#....#..\n..#....#..\n\n")
if S[i]= 'I' or 'i' then print("..######..\n....##....\n....##....\n....##....\n..######..\n\n")
if S[i]= 'J' or 'j' then print("..######..\n....##....\n....##....\n..#.##....\n..####....\n\n")
if S[i]= 'K' or 'k' then print("..#...#...\n..#..#....\n..##......\n..#..#....\n..#...#...\n\n")
if S[i]= 'L' or 'l' then print("..#.......\n..#.......\n..#.......\n..#.......\n..######..\n\n")
if S[i]= 'M' or 'm' then print("..#....#..\n..##..##..\n..#.##.#..\n..#....#..\n..#....#..\n\n")
if S[i]= 'N' or 'n' then print("..#....#..\n..##...#..\n..#.#..#..\n..#..#.#..\n..#...##..\n\n")
if S[i]= 'O' or 'o' then print("..######..\n..#....#..\n..#....#..\n..#....#..\n..######..\n\n")
if S[i]= 'P' or 'p' then print("..######..\n..#....#..\n..######..\n..#.......\n..#.......\n\n")
if S[i]= 'Q' or 'q' then print("..######..\n..#....#..\n..#.#..#..\n..#..#.#..\n..######..\n\n")
if S[i]= 'R' or 'r' then print("..######..\n..#....#..\n..#.##...\n..#...#...\n..#....#..\n\n")
if S[i]= 'S' or 's' then print("..######..\n..#.......\n..######..\n.......#..\n..######..\n\n")
if S[i]= 'T' or 't' then print("..######..\n....##....\n....##....\n....##....\n....##....\n\n")
if S[i]= 'U' or 'u' then print("..#....#..\n..#....#..\n..#....#..\n..#....#..\n..######..\n\n")
if S[i]= 'V' or 'v' then print("..#....#..\n..#....#..\n..#....#..\n...#..#...\n....##....\n\n")
if S[i]= 'W' or 'w' then print("..#....#..\n..#....#..\n..#.##.#..\n..##..##..\n..#....#..\n\n")
if S[i]= 'X' or 'x' then print("..#....#..\n...#..#...\n....##....\n...#..#...\n..#....#..\n\n")
if S[i]= 'Y' or 'y' then print("..#....#..\n...#..#...\n....##....\n....##....\n....##....\n\n")
if S[i]= 'Z' or 'z' then print("..######..\n......#...\n.....#....\n....#.....\n..######..\n\n")
File "program.py", line 3
while i<0 len(name):s
^
SyntaxError: invalid syntax
This is what comes up. I tried to fix it, but then every other line comes up with the same thing.
if S[i] == 'B': print('## whatever'). Convert the whole string to upper case before the loop, so you havent got to try to match both cases.while i < len(name):(note the colon). You also need to remove the0and thesfrom the line. Then you need to indent all theifs that follow thewhilestatement. You also do not handle theors correctly in yourifstatements. (This is a logic error, not a syntax error.) The previous comment points out thatthendoes not belong in Python. You have a lot of learning to do about Python!