Q. Write a program to print the following pattern :-
********
*
*
*
*
*
********
Answer =
for i in range (8): for j in range(8): if i==0 or i==7: print("*",end=" " ) elif j==8-(1+i): print("*",end=" " ) else: print(" ",end=" " ) print()
for i in range (8): for j in range(8): if i==0 or i==7: print("*",end=" " ) elif j==8-(1+i): print("*",end=" " ) else: print(" ",end=" " ) print()
Not got the required output!!
ReplyDeleteCopy the whole program as it is .
DeleteThe correct code should be:
Deletefor i in range (8):
for j in range(8):
if i==0 or i==7:
print("*",end=" " )
elif j==8-(1+i):
print("*",end=" " )
else:
print(" ",end=" " )
print()
The code given by you is not yeilding proper required output , i have corrected the code so please update it. Thank me later.
ReplyDeleteCode-
for i in range (8):
for j in range(8):
if i==0 or i==7:
print("*",end=" " )
elif j==8-(1+i):
print("*",end=" " )
else:
print(" ",end=" " )
print()
Kindly check the indentation level yourself as it is not allowing spaces
DeleteOk, I have corrected it.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )