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 :: Illustrate Different Set Operations 
Python :: Python Program to Display Powers of 2 Using Anonymous Function 
Python :: Dizideki en son elemani alma 
Python :: Using CGI with Python and HTML forms 
Python :: python round function 
Python :: create date range python 
Python :: networkx - unique combinations of paths 
Python :: spark sparsevector to list 
Python :: Convert torch.nn.Embedding layer to numpy array 
Python :: animal quiz game in python 
Python :: reopen closed file python 
Python :: setheading in python 
Python :: get resource path python 
Python :: when was barracoon written 
Python :: python pywin32 get current cursor row 
Python :: pip unknown command import 
Python :: pygame do you need to use int() for positions 
Python :: using django celery 5.0 
Python :: right click vs left click pygame 
Python :: python pass statement 
Python :: RC style Relative Referencing in OpenPyXL 
Python :: html to image pygame python 
Python :: how to make a timer in pyothn 
Python :: Complete the function that accepts a string parameter, and reverses each word in the string. All spaces in the string should be retained. python 
Python :: how to access clipboard with python 
Python :: np logical and 
Python :: linke dlists in python 
Python :: HIDING AND ENCRYPTING USING BASE24 MODULE 
Python :: python cheat sheets 
Python :: How to combine two or more querysets in a Django view? 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =