Khantan's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
3 (0 per day)
Joined:
22-November 12
Profile Views:
95
Last Active:
User is offline Nov 23 2012 09:35 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Khantan has not set their status

Posts I've Made

  1. In Topic: Populate Matrix with Strings

    Posted 22 Nov 2012

    Fixed the problem in another forum :bananaman:


    After reading n, i inserted
    a = [ [ '~' for _ in range(n) ] for _ in range(n) ]
    


    now works.

    Halleluyah

    View PostSimown, on 22 November 2012 - 05:06 PM, said:

    Hello! I had a look at your program and this seems to be the problem:

    When you are trying to create the matrix you are not actually populating a at all! It will be empty!

    You:
    print "~"
    

    But you mean to set :
    a[i][j] = "~"
    
    


    Do you understand what I mean? Also, a is not a 2 dimensional array, it's a 1 dimensional structure at the moment. If you need more help fixing it we'd be happy to help.


    Didn't see your post, you must've posted a few seconds before me.


    It's so simple now, that I know the answer, I'm almost ashamed now. Thank you anyway!! :bigsmile:
  2. In Topic: Populate Matrix with Strings

    Posted 22 Nov 2012

    Thanks for your fast answer.

    But I'm afraid this doesn't solve my problem.

    The problem is

    IndexError: list index out of range

    If that helps you find my problem :)

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Khantan hasn't added any friends yet.

Comments

Khantan has no profile comments yet. Why not say hello?