What I'm trying to do is make a 3x3, 4x4 or 5x5 matrix of "~" signs, that would get replaced by "X" 3 times,
depending on coordinates given by x and y imputs, appended in s=[]
so for example if i have a matrix 3x3
~~~
~~~
~~~
and coordinate (0,0),
the result should be:
X~~
~~~
~~~
As easy as it sounds it's not easy for me still, I get problem even if my code seems logical to me.
Some help would be so much appreciated, thanks.
a = []
n=0
while n<3 or n>5:
n=int(raw_input("type matrix: "))
for i in range (n):
for j in range (n):
print "~",
print "\n",
def zdruzi(a):
for row in a:
print " ".join(row)
zdruzi(a)
s = []
for i in range(3):
x=int(raw_input("x: "))
y=int(raw_input("y: "))
s.append(int(x))
s.append(int(y))
a[int(x)][int(y)]="X"
if (x<0) or (x>(n-1)):
print "not good"
break
print a
This post has been edited by macosxnerd101: 22 November 2012 - 04:26 PM
Reason for edit:: Please use a descriptive title

New Topic/Question
Reply




MultiQuote






|