-2
I am trying to make a program that makes the letters of the alphabet in triangle type so the user enters with an integer number and the result is displayed in triangle form.
7:
A
BB
CCC
DDDD
EEEEE
FFFFFF
GGGGGGG
4:
A
BB
CCC
DDDD
I’ve tried wearing the bow tie for
but I couldn’t. Follow my attempt:
N = int(input())
if N == 1:
print('A')
if N == 2:
print('A\n'
'BB')
if N == 3:
print('A\n'
'BB\n'
'CCC')
if N == 4:
print('A\n'
'BB\n'
'CCC\n'
'DDDD')
if N == 5:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE')
if N == 6:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF')
if N == 7:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG')
if N == 8:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG\n'
'HHHHHHHH')
if N == 9:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG\n'
'HHHHHHHH\n'
'IIIIIIIII\n')
if N == 10:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG\n'
'HHHHHHHH\n'
'IIIIIIIII\n'
'JJJJJJJJJJ')
if N == 11:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG\n'
'HHHHHHHH\n'
'IIIIIIIII\n'
'JJJJJJJJJJ\n'
'KKKKKKKKKKK\n')
if N == 12:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n'
'FFFFFF\n'
'GGGGGGG\n'
'HHHHHHHH\n'
'IIIIIIIII\n'
'JJJJJJJJJJ\n'
'KKKKKKKKKKK\n'
'LLLLLLLLLLLL\n')
if N == 13:
print('A\n'
'BB\n'
'CCC\n'
'DDDD\n'
'EEEEE\n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n'
'UUUUUUUUUUUUUUUUUUUUU\n'
'XXXXXXXXXXXXXXXXXXXXXXX\n'
'WWWWWWWWWWWWWWWWWWWWWWWW\n'
'YYYYYYYYYYYYYYYYYYYYYYYYY\n'
'ZZZZZZZZZZZZZZZZZZZZZZZZZZ\n')
How do I get this same result using loop for
?
Could you show us how you did with the bow tie
for
?– Woss
Lucas, I edited your question in an attempt to make it clearer. If you don’t approve the modifications you can enter edition history and reverse the modifications.
– Augusto Vasques
https://ideone.com/AkNqFj
– hkotsubo