473,378 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

something wrong to uri 1478 solution

I am new at python...I write this code. This is a uri problem and problem no 1478.Here the uri problem link:https://www.urionlinejudge.com.br/ju...lems/view/1478
My code:
Expand|Select|Wrap|Line Numbers
  1. while(1):
  2.     N=int(input())
  3.     if(N==0):
  4.         break
  5.  
  6.     mainlist=[]
  7.     for i in range(0,N):
  8.         sublist=[]
  9.         for j in range(0,N):
  10.             sublist.append(9)
  11.         mainlist.append(sublist)
  12.  
  13.     print(mainlist)
  14.  
  15.     a=0
  16.     b=N
  17.     c=0
  18.     d=N-1
  19.     k=1
  20.     for j in range(0,N):
  21.         for i in range(a,b):
  22.             mainlist[c][i]=i+k
  23.             mainlist[i][c]=i+k
  24.             mainlist[d][N-1-i]=i+k
  25.             mainlist[N-1-i][d]=i+k
  26.  
  27.         a+=1
  28.         b-=1
  29.         c+=1
  30.         d-=1
  31.         k-=1
  32.  
  33.     for i in range(0,N):
  34.         for j in range(0,N-1):
  35.             print(" ",mainlist[i][j],end=" ")
  36.         print(" ",mainlist[i][N-1])
  37.     print("")
but when i submit this on uri...showing something error.and couldnt found this.Please anyone help me to fine the error of my code.
Jul 9 '18 #1
1 1707
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

Did you try running your code to see if the output matches? Because it doesn't. Your code prints out extra stuff that it's not looking for. Specifically arrays filled with a bunch of 9s.
Jul 9 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: uberderf | last post by:
I have the following web page setup: http://angels.uberderf.com/glossary.html I have a 2 column table layout which is a glossary of terms and their meanings. When you view this page in firefox...
3
by: Charles May | last post by:
I have a listview which checkboxes containing items to invoice. The Create Invoice button (button1) is disabled unless there are items checked. However, I had to use an if..then..else statement to...
4
by: Robert | last post by:
something wrong in wx I wrote program training na Artificial Neural Network. It work well in console mode, but when I try to add GUI there is an error: FANN Error 10: Error reading info from...
3
by: Cor | last post by:
Hi all, I think I do something wrong, but I don't see what. I have made a sample. The sample needs only a form with a combobox and this code. (I can tell you that it took a long time to see...
1
by: Holly | last post by:
One of my clients called me this morning, having trouble with their blog loading. The blog does actually load, but only after such an unusually long wait it would have surely driven everyone else...
9
by: Randy | last post by:
Hi all, I've been working on a simple two column layout for a site, but according to browsershots.org, my desing is not showing up correctly in Win/IE 5.01, 5.5 & 6 ! Please see details here:...
1
by: alvarojaviervera | last post by:
Allways I think Firefox was strong, enough ... and so far THE BEST Web- browser (That what I Think) but, now Im fighting with it, may be Im doing something wrong (of course that is what happend to...
13
compman9902
by: compman9902 | last post by:
Hello, and thank you for hwlping me with this run-in with trouble. I am making a script for pig latin transulation, and there is something wrong with the "if" statement in line 51. Here is the code...
10
by: Guillermo_Lopez | last post by:
Hello All, I am using VBA in access to perform some calculations. There is a particular sumation that is wrong (barely). this code is withing a loop. TDist = TDist + TempDist Both TDist...
0
by: Pat | last post by:
Hi Guys, Please help me. I am having a strange issue. Not sure if I am doing something wrong or this is a bug. This is a sample code. This contains 2 text boxes(txtName, txtPhone) and 2 buttons...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.