Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:07:42+00:00 2026-06-14T20:07:42+00:00

Having some difficulty here. My goal is to read numbers from a column in

  • 0

Having some difficulty here. My goal is to read numbers from a column in a gameboard and print these numbers out as a specific list. I don’t have much experience with lists and neither do I grasp the concept properly so I’m having some difficulty with getting them to work. So far, all I could muster was this:

def getColumn ():
    for i in range (0, 9):
        row = datalist[i]
        column = row[x]
        column.append[i]

Doesn’t seem to work properly, could anyone point out why? I would really appreciate it!

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:07:43+00:00Added an answer on June 14, 2026 at 8:07 pm

    Here’s a version that tweaks your original code:

    datalist = [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]
    ]
    
    def getColumn(col_num, data):
        column = []
        for i in range (0, len(data)):
            row = data[i]
            column.append(row[col_num])
        return column
    

    Which gives:

    getColumn(1, datalist)
    Out[9]: [2, 5, 8]
    

    Some problems with your original code:

    • You didn’t have any way to tell getColumn which column you wanted- you need to make this an argument of your function
    • getColumn relied on there being a global variable called datalist. Passing the data as an argument is safer.
    • datalist had to have exactly nine rows, or you’d get errors or wouldn’t get the full column returned.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im having some difficulty trying to pull out a specific value from a cookie.
I am having some difficulty converting this list of strings into a list of
I am having some difficulty figuring out how to return the selected item in
I'm having some difficulty figuring out the best ways to pause and resume my
I am having some difficulty with importing data from a .csv file. I am
I am having some difficulty redirecting links. Here is a simple example and I
I'm having some difficulty with pop up images in JQuery. Here's a link to
I'm having some difficulty embedding an image from the Properties.Resources to a MailMessage, currently
I'm having some difficulty cloning my mercurial repository over ssh. Here's what I have
I'm having some difficulty passing values and arrays between this two functions Here's the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.