pyramid pattern in python code example
Example 1: pyramid pattern in python
n = 3
for i in range(1, n+1):
print(f"{' '*(n-i)}{' *'*i}"[1:])
Example 2: python pyramid
py -m pip install pyramid
setx PATH "%PATH%;C:\<path\to\python\directory\>\Scripts"
pip install pyramid
pip3 install pyramid --upgrade
py -m pip install --trusted-host pypi.python.org pip pyramid
py -m pip install --user pyramid
py -m venv c:\path\to\new\environment
c:\path\to\new\environment\Scripts\activate.bat
Example 3: pattern in python
rows = 6
for i in range(1, rows + 1):
for j in range(1, i - 1):
print(j, end=" ")
for j in range(i - 1, 0, -1):
print(j, end=" ")
print()
Example 4: * pattern by python
def pattern(n):
for i in range(0,n):
for j in range(0, i+1):
print("* " , end="")
print("\r") pattern(5