pattern printing

Question

Print the following pattern:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

in progress 0
YashikaKhurana 55 years 2 Answers 718 views Master 0

Answers ( 2 )

  1. rows = 5
    for i in range(0, rows):
    for j in range(0, i + 1):
    print(“*”, end=’ ‘)
    print(“r”)

    for i in range(rows, 0, -1):
    for j in range(0, i – 1):
    print(“*”, end=’ ‘)
    print(“r”)

  2. for i in range(25,51):
    s=0
    for j in range(2,i):
    if i%j==0:
    s=s+1
    if s==0:
    print(i)

Leave an answer

Browse
Browse