Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

for i in range(rows, 1, -1):
    for space in range(0, rows-i):
        print("  ", end="")
    for j in range(i, 2*i-1):
        print("* ", end="")
    for j in range(1, i-1):
        print("* ", end="")
    print()
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

ascii_value = 65

for i in range(rows):
    for j in range(i+1):
        alphabet = chr(ascii_value)
        print(alphabet, end=" ")
    
    ascii_value += 1
    print("
")
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

k = 0
count=0
count1=0

for i in range(1, rows+1):
    for space in range(1, (rows-i)+1):
        print("  ", end="")
        count+=1
    
    while k!=((2*i)-1):
        if count<=rows-1:
            print(i+k, end=" ")
            count+=1
        else:
            count1+=1
            print(i+k-(2*count1), end=" ")
        k += 1
    
    count1 = count = k = 0
    print()
Comment

how to make a half pyramid in python

row = int(input("Enter total row = "))
for x in range(1, row+1):
    print(x*"* ")
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

for i in range(rows):
    for j in range(i+1):
        print(j+1, end=" ")
    print("
")
Comment

python Pyramid Patterns half

A
B B
C C C
D D D D
E E E E E
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

for i in range(rows, 0, -1):
    for j in range(0, i):
        print("* ", end=" ")
    
    print("
")
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

for i in range(rows, 0, -1):
    for j in range(1, i+1):
        print(j, end=" ")
    
    print("
")
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))

k = 0

for i in range(1, rows+1):
    for space in range(1, (rows-i)+1):
        print(end="  ")
   
    while k!=(2*i-1):
        print("* ", end="")
        k += 1
   
    k = 0
    print()
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))
coef = 1

for i in range(1, rows+1):
    for space in range(1, rows-i+1):
        print(" ",end="")
    for j in range(0, i):
        if j==0 or i==0:
            coef = 1
        else:
            coef = coef * (i - j)//j
        print(coef, end = " ")
    print()
Comment

python Pyramid Patterns half

rows = int(input("Enter number of rows: "))
number = 1

for i in range(1, rows+1):
    for j in range(1, i+1):
        print(number, end=" ")
        number += 1
    print()
Comment

PREVIOUS NEXT
Code Example
Python :: what does scalar.fit do 
Python :: python readlines  
Python :: dimensions of dataset in python 
Python :: changing labels of facetgrid 
Python :: empty list 
Python :: gitlab ci deploy key 
Python :: lxml etree fromstring find 
Python :: first duplicate 
Python :: How to correctly call url_for and specify path parameters 
Python :: if space bar pressed pygame 
Python :: Filling a missing value in a pandas data frame with an if statement based on a condition 
Python :: django add list to manytomany 
Python :: python complement operator 
Python :: sns.kdeplot make line more detailed 
Python :: ring retrieves the list of all algorithms supported by Encrypt()/Decrypt() functions. 
Python :: ring Using the Natural Library 
Python :: rpi python read spi 
Python :: view scrapy response in chrome from inside the spider 
Python :: python loc id in list 
Python :: python list of datetimes as type string 
Python :: print(1) in python 
Python :: get picamera feed 
Python :: run django using nssm 
Python :: jupter notebook save session variables 
Python :: static instance and local variables in python 
Python :: how to add trailing zeros in the number 
Python :: print start time in python 
Python :: code suggestion html not working in django-html 
Python :: python break out of function 
Python :: Joint Grid plot in seaborn 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =