Share
pattern printing
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Print the following pattern:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
Answers ( 2 )
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”)
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)