this program outputs a user's name in the symbols as given below. instead of typing all letters in * s. how can i create a program that will take in A and print in terms of *s without this lengthy typing
def patt(name):
length = len(name)
for i in range(0,length):
n = name[i]
if n == 'A':
print("""
***
* *
*******
** ** """)
elif n == 'B':
print("""
******
* *
******
* *
*******
""")
elif n == 'C':
print("""
*******
*
*
*
*******
""")
elif n == 'D':
print("""
*******
* *
* *
* *
*******
""")
elif n == 'E':
# etc
def main():
name = input("please enter your name: ")
patt(name)
main()
Use the banner program on Linux to covert any string to the pattern with #s.
$ banner P
######
# #
# #
######
#
#
#
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.