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

  • SEARCH
  • Home
  • 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 7532309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:24:54+00:00 2026-05-30T05:24:54+00:00

Possible Duplicate: Python List vs. Array – when to use? I’m working on a

  • 0

Possible Duplicate:
Python List vs. Array – when to use?

I’m working on a few projects in Python, and I have a few questions:

  1. What’s the difference between Arrays and Lists?
  2. If it’s not obvious from question 1, which should I use?
  3. How do you use the preferred one? (create array/list, add item, remove item, pick random item)
  • 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-05-30T05:24:55+00:00Added an answer on May 30, 2026 at 5:24 am

    Use lists unless you want some very specific features that are in the C array libraries.

    python really has three primitive data structures

    tuple = ('a','b','c')
    list = ['a','b','c']
    dict = {'a':1, 'b': true, 'c': "name"}
    
    list.append('d') #will add 'd' to the list
    list[0] #will get the first item 'a'
    
    list.insert(i, x) # Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).    
    
    list.pop(2) # will remove items by position (index), remove the 3rd item
    list.remove(x) # Remove the first item from the list whose value is x.
    
    list.index(x) # Return the index in the list of the first item whose value is x. It is an error if there is no such item.
    
    list.count(x) # Return the number of times x appears in the list.
    
    list.sort(cmp=None, key=None, reverse=False) # Sort the items of the list in place (the arguments can be used for sort customization, see sorted() for their explanation).
    
    list.reverse() # Reverse the elements of the list, in place.
    

    More on data structures here:
    http://docs.python.org/tutorial/datastructures.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Python - Differences between elements of a list I have a list
Possible Duplicate: How can I turn a list into an array in python? How
Possible Duplicate: Flatten (an irregular) list of lists in Python I have the following
Possible Duplicate: Some built-in to pad a list in python I have a method
Possible Duplicate: Python: simple list merging based on intersections I have a multiple list:
Possible Duplicate: iterate through pairs of items in python list I have a list
Possible Duplicate: Flatten (an irregular) list of lists in Python I'm trying to use
Possible Duplicate: Getting list of parameters inside python function E.g. supposes I have def
Possible Duplicate: Dynamic module import in Python I have a list of modules, like
Possible Duplicate: Shuffling a list of objects in python IF I have a list:

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.