I tried to print the letter "A" using patterns in python
def printA(length,height,symbol):
a = [[" " for i in range(length)] for i in range(height)]
for i in range(height):
for j in range(length):
if j == 0 or i == 0 or i == height // 2 or j == length - 1:a[i][j] = symbol
return a
It works for normal characters like *,/+,-,#,$,% .. etc.,
Output: Normal Characters
#######
# #
# #
#######
# #
# #
# #
Emoji
πππππππ
π π
π π
πππππππ
π π
π π
π π
if i can find the length of the emoji , then i will be able to change the spaces to the length of the emoji so this problem won't occur, is there any way to do this
Note : The above code works only for characters and not strings
EDIT :
As of snakecharmerb's answer it works for printing just the character A
but when i try to print sequnces of A
i.e more than once it just misplacing the emojis
Example : I tried to print AAAAA
Output :
From the above output as we increase the letter's position it gets repositioning itself is there any way to prevent this from occuring
I printed the AAAAA
like this
a = printA(7,7,"π")
for i in a:
for k in range(5):print(*(i),end=" ")
print()
printA(5,6,"##")
and you will find that it prints similar to the emojis. You need to fix the code differently. β Doy