KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Write a program to accept a symbol from the user and draw the following pattern containing that symbol.

Input: Enter the symbol: *

Output:

*  
* *  
* * *  
* * * *  

Python Control Flow

1 Like

Answer

sym = input("Enter the symbol: ")
for i in range(1, 5):
    print((sym + " ") * i)

Output

Enter the symbol: *
* 
* *
* * *
* * * *

Enter the symbol: #
# 
# #
# # #
# # # #

Answered By

1 Like


Related Questions