713
In this example we print a pyramid star pattern in python
Code
rows = int(input("Enter amount of rows = ")) print("Pattern") for i in range(0, rows): for j in range(0, rows - i - 1): print(end = ' ') for k in range(0, i + 1): print('*', end = ' ') print()
When you run this you will something like this
alternative example
def drawPyramid(rows, symbol): for i in range(0, rows): for j in range(0, rows - i - 1): print(end = ' ') for k in range(0, i + 1): print('%c' %symbol, end = ' ') print() rows = int(input("Enter amount of rows = ")) symbol = input("Symbol = ") drawPyramid(rows, symbol)