Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with cross
#1
Hello guys. Can u help me with this pattern ?

I've tried to do this with matrix but i did square and then i dont know how can i turn my square to this cross.
def square(n):
matrix=['*',' ','D','X']
for g in range(n):
for s in range(n):
for i in range(2):
for j in range(1):
print(matrix[i][j],end='')
print()

square(9)
Angry Angry[/i]
#2
Why do you want to compute your cross, instead of printing like:

print(" * ")
print("***")
print(" * ")
#3
Because then i need to make a game man dont get angry on this pattern and i dont know how to control it..
#4
Ok, if n==9, you want the above cross.

What do you want for n = 10, n = 20, n =... ?
a. the same cross
b. the cross should scale
#5
The scale of cross should be every uneven number (9,11,13....)
#6
Please make a sample for n=19
#7
this is my problem i cant make cross when its n=9 and im sure that i wont know how to make it when its n=19 Cry Cry Cry If u know how to do it for 9 it would be best Big Grin
#8
Sorry, I need a sample for n=19 made by hand,
because there are more than 1 possibilities
how scaling works.
#9
The project is about making a game "Man dont get angry" so i think this scale of n=9 should be fine of course if u know that game Cry
#10
#!/usr/bin/python3
matrix = [ "   ***   "
         , "   *d*   "
         , "   *d*   "
         , "****d****"
         , "*dddxddd*"
         , "****d****"
         , "   *d*   "
         , "   *d*   "
         , "   ***   "
         ]

for s in matrix:
    print(s)

print(matrix[4][4]) # ==> "x"


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020