rajendranvimal8 def pattern(n): for i in range(1,n+1): print((i-1)*’ ‘+n*’*’) pattern(5) Log in to Reply
dronamraju rows=int(input()) tot=2*rows-1 #Bottom line consists of 2*rows-1 stars j=1 for i in range(rows): s=” “*(tot//2)+’*’*j print(s) tot-=2 j+=2 Log in to Reply
Pravallika n = int(input()) #number of rows m = n #for white spaces for i in range(n+1): for k in range(m): print(” “,end=””) m -= 1 for j in range(i*2-1): print(“*”,end=””) print() Log in to Reply
Krishan Python3 Code: def pattern(r): ”’ Rhombus Star Pattern Difficulty ”’ for i in range(r): print(i*’ ‘ + r*’*’) if __name__ == “__main__”: rows = int(input(‘Enter number of rows: ‘)) pattern(rows) Log in to Reply
shreyank def rhombusStarpattern(rows): for i in range (1,rows + 1): for j in range (1,rows + i + 1): print (end=” “) for j in range (1,rows + 1): print (“*”,end=””) # Move to the next line/row print() # utility program to print all patterns def printPattern(rows): rhombusStarpattern(rows) # driver program if __name__ == “__main__”: rows = 4 printPattern (rows) Log in to Reply
Karthick Ramesh n=int(input()) for i in range(0,n): for j in range(0,i): print(” “,end=”) for j in range(n): print(“*”,end=”) print() Log in to Reply
sampath pendurthi n=int(input(“enter a number:”) for i in range(n): for j in range(n): print(“*”,end=””) print(end=”\n”+” “*(i+1)) Log in to Reply
s=input()
a=int(input())
for i in range(a):
print(” “*i + s*a)
def pattern(n):
for i in range(1,n+1):
print((i-1)*’ ‘+n*’*’)
pattern(5)
rows=int(input())
tot=2*rows-1 #Bottom line consists of 2*rows-1 stars
j=1
for i in range(rows):
s=” “*(tot//2)+’*’*j
print(s)
tot-=2
j+=2
n = int(input()) #number of rows
m = n #for white spaces
for i in range(n+1):
for k in range(m):
print(” “,end=””)
m -= 1
for j in range(i*2-1):
print(“*”,end=””)
print()
Python3 Code:
def pattern(r):
”’ Rhombus Star Pattern Difficulty ”’
for i in range(r):
print(i*’ ‘ + r*’*’)
if __name__ == “__main__”:
rows = int(input(‘Enter number of rows: ‘))
pattern(rows)
def rhombusStarpattern(rows):
for i in range (1,rows + 1):
for j in range (1,rows + i + 1):
print (end=” “)
for j in range (1,rows + 1):
print (“*”,end=””)
# Move to the next line/row
print()
# utility program to print all patterns
def printPattern(rows):
rhombusStarpattern(rows)
# driver program
if __name__ == “__main__”:
rows = 4
printPattern (rows)
Thanks for contributing the code Shreyank
n=int(input())
for i in range(n):
print (‘*’*n)
print (‘ ‘*(i+1),end=”)
for i in range(n):
print(‘ ‘*i + ‘*’*n)
Very nice
n=int(input())
for i in range(0,n):
for j in range(0,i):
print(” “,end=”)
for j in range(n):
print(“*”,end=”)
print()
what does *(i+1) do?
n=int(input(“enter a number:”)
for i in range(n):
for j in range(n):
print(“*”,end=””)
print(end=”\n”+” “*(i+1))
n=int(raw_input())
for i in range(n):
s=””
s=” “*i
s+=”*”*n
print(s)