Python Lists || Python Tutorial || Learn Python Programming

  • Published on Apr 13, 2016
  • Lists are a way to store ordered data. In this Python tutorial, we show you how to create lists, access elements by index, slice lists, join two lists (concatenation), and more. We will talk about sets, dictionaries and tuples in separate videos.
    To learn Python, you can watch our playlist from the beginning:
    We recommend:
    Python Cookbook, Third edition from O’Reilly
    The Mythical Man Month - Essays on Software Engineering & Project Management
    Shop Amazon Used Textbooks - Save up to 90%
    Subscribe to Socratica:
    To support more videos from Socratica, visit
    Socratica Patreon
    Socratica Paypal
    We also accept Bitcoin! :)
    Our address is: 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
    Python instructor: Ulka Simone Mohanty
    Written & Produced by Michael Harrison
    FX by Andriy Kostyuk

Comments • 110

  • Jonathan Davis
    Jonathan Davis Day ago

    how does she do the sound effects and background, so cool

  • Singularity
    Singularity 12 days ago

    *socratica:* "Lists start at zero..."
    *lua:* "Them fighting words!"

  • leathernluv
    leathernluv 23 days ago

    To get the list reversed, but not reverse the list in place: example[::-1]
    That way you get the reverse without changing the list order. I figured that one out via typo.

  • Alexander Zhang
    Alexander Zhang 23 days ago


  • ShakespeareCafe
    ShakespeareCafe 26 days ago

    This woman looks and sounds exactly like Wendy Rhoades on Showtime's Billions, which is one of the best shows after Breaking Bad

  • Esteban Escudero
    Esteban Escudero Month ago

    I really enjoy your videos. You make learning very easy and interesting. Thumbs up for the length of each video also. They are short as they should, but with plenty of useful info. You have won a subscriber. :)

  • Yamkela Balisa
    Yamkela Balisa 2 months ago

    what does the return statement actually do in python?
    im still a beginner

    • Yamkela Balisa
      Yamkela Balisa 2 months ago

      can one clear makes more than one example for me, 2 or 3 will be enough

  • Venkat Gurram
    Venkat Gurram 3 months ago

    very creative presentation with sci-fi feel. The girl is a good actor and has the looks.

  • Linda Tochukwu
    Linda Tochukwu 3 months ago

    on point ur charisma

  • Ismael Amorim
    Ismael Amorim 4 months ago

    Super maravilhoso essas Aulas

  • William Smith
    William Smith 4 months ago

    uh how do you find the amount of values in a list

  • S M Fahim
    S M Fahim 5 months ago

    when I use:
    I get some results and the first 3 are:
    '__add__', '__class__', '__contains__'
    But how to use these classes which contains double underscores?

  • Yousif Ahmed
    Yousif Ahmed 5 months ago

    You are very great. Thank you a lot

  • Hritik Vashishth
    Hritik Vashishth 5 months ago

    she sounds exactly like cortana from halo

  • Elias Alirio Moran Saget

    You are fun :)

  • eng
    eng 6 months ago +1

    Please make a udemy or Udacity course for Python would definitely buy

  • Vasconcelos
    Vasconcelos 6 months ago

    thank you for do this videos

  • MD Sadaquat hussain
    MD Sadaquat hussain 6 months ago

    Guys check out telusko also..its a good source for beginners with around 74 videos..Thank me later😀

  • Naat Status
    Naat Status 6 months ago

    Great video but I think there is some missing...........!!!!

  • Kizito Bukenya
    Kizito Bukenya 6 months ago

    This an amazing video

  • Spyder Spyder
    Spyder Spyder 6 months ago

    Very good tutorial. I liked it

  • Tamer Aziz
    Tamer Aziz 6 months ago


  • ehud ezra
    ehud ezra 6 months ago

    hi, I need an example of inputting a list(i have a numbers list) with a square parenthesis and a comma from the user. the sooner the better. thank you so much, your clips help so much, I can't thank you enough.

  • cornelxbox25
    cornelxbox25 7 months ago +1

    Socratica.... You just made the list!!!

  • Daniel Fernandes
    Daniel Fernandes 7 months ago

    I like this Command & Conquer feeling every time I watch your videos :)

    • Bruno Oliveira
      Bruno Oliveira 7 months ago

      Just hopping for her to say: "unable to comply, building in progress"

  • T DJ
    T DJ 8 months ago +4

    "In lists, order is everything" dun dun dun

  • Rambabu verma
    Rambabu verma 9 months ago

    Can I insert value in list using command line using while loop...........plz provide me this code

    • Rambabu verma
      Rambabu verma 9 months ago

      As we insert in array in c programing. Is it possible there.

  • Francis
    Francis 9 months ago

    She deserves a grammy.

  • pravin
    pravin 9 months ago +1

    "i would have a very, very long list." I am falling for this host! Somebody help me

  • Ben Rawner
    Ben Rawner 9 months ago

    These are the best Python videos

  • Hugo
    Hugo 10 months ago


  • mehjebin mujeeb
    mehjebin mujeeb 10 months ago +11

    I don't think I've ever enjoyed learning so much!!!

    • Socratica
      Socratica  10 months ago

      That is so wonderful to hear!! We're so glad you're watching.

  • GEScott71
    GEScott71 10 months ago

    Another great tuturial, thanks! I just made a contribution and all of you should too :-)

  • Josip Marić
    Josip Marić 11 months ago

    freakin awsome video i feel like i'm in some game and after a video when i enter my text editor like i'm in freakin army mission lol.

  • Cerbyo
    Cerbyo 11 months ago

    reverse(...) method of builtins.list instance
    L.reverse() -- reverse *IN PLACE*
    Okay how the hell does that tell me anything much lesss everything? I type
    reverse(mylistname)....I get an error
    I type L.reverse(mylistname)....I get an error.
    ???????????????????????????? really tells me sooo much. Reverse will REverse *inplace*? Wouldn't a clearer method be "will invert entries" or "will change order making last entry first, first entry last etc"??

    • Cerbyo
      Cerbyo 11 months ago

      a= list(reversed(primesorwhateverurlistnameis)) will display the list in reverse and allow you to call it up as 'a' instead of typing the whole bit each time u want it displayed reverse since it doesn't apply it straight to ur list. BUT THE FRIGGIN HELP THING DOESN'T TELL YOU ANY OF THAT.

  • Yilmaz Bingol
    Yilmaz Bingol 11 months ago


  • sharmila rani
    sharmila rani 11 months ago

    it is so interesting to watch video of u

  • ame7272
    ame7272 11 months ago

    You had me at "Order...matters" lol

  • TheBobbyking82
    TheBobbyking82 11 months ago

    Great video! I love the whole futuristic look. just sub, hoping to learn python to try to eventually head to C++.

  • ParaDise
    ParaDise 11 months ago

    Very beautiful video !! I actually learned something !!!

  • Video Collector
    Video Collector 11 months ago

    I am using Windows10 and I have write some codes to scrape information from a website but I can't copy anything from my command prompt or anaconda prompt. I figure it out that my mouse dosen't working on both command prompt. Can anybody help me?

  • Johny knows
    Johny knows Year ago

    а по русски мона?

  • Tanner Barcelos
    Tanner Barcelos Year ago +3

    Plot twist: this is an AI machine teaching us this.. the coded AI bot is teaching us... to code ? 🤔😂

  • Breath Growth
    Breath Growth Year ago

    Oh her voice really gets my attention, i can finaly probably learn this

  • SuperBror1
    SuperBror1 Year ago

    I'm just a beginner at Python and 11years old, and I understood! Good job!:D

    • pablo ramos
      pablo ramos Month ago

      Escape the Minecraft kido, and you'll be free to code an AI army... hehehehehhe

  • 王玮
    王玮 Year ago +1

    One of the best video tutorials ever

  • S Schiavo
    S Schiavo Year ago

    Excellent video - thanks!

  • Alexander Lysberg

    I like to think of slicing as the first unit starting from 0, and the second unit starting from 1. If you have a list of [a. b. c. d. e] and you want the 2:4 slice, you can count a = 0, b = 1 c = 2 (start slice). Then you can count again a = 1, b = 2, c = 3, d = 4 (end slice).
    Because "2 to 4 but not including 4" is such a hassle to say in the head.

  • mrbrockpeters
    mrbrockpeters Year ago +6

    This is my favorite resource for learning Python lately. Short and to the point explanations. I don't use Python enough. In fact, I only seem to use it in the context of working with the Amazon AWS CLI tool.
    Nevertheless, I got a website in PHP that computes does some computations at night. My buddy turned me onto Python when he wrote a sample script that did the job of a PHP script in like a few seconds whereas it took the PHP script like almost 5 minutes to complete. I'm gonna figure out how to port those scripts into Python in my leisure time at night and it's gonna be fun as hell yo! It'll take me some time to figure out but I think it'll pay off later when all those cron jobs are complete faster.
    Step 1. Figure out how to work with Lists.

  • Melinda Sterne
    Melinda Sterne Year ago

    great videos! so informative

  • Ben
    Ben Year ago

    Python is so bizarre not used to a language like this

  • bobby midha
    bobby midha Year ago

    My lists are not maintaining their order. What am I doing wrong?

    • Mr. Nathan Oldridge
      Mr. Nathan Oldridge 8 months ago

      We believe you are using sets, instead of lists.
      Sets don't have an order, and are declared with { }
      Lists have order, and are declared with [ ]

  • Tech Titans
    Tech Titans Year ago

    Your video was really good. Great explanations. I especially like the fact that you were very clear and detailed with defining #concatenation and one can identify an element that is connected to a particular index. It was really helpful to me that you did not stray off topic by talking about your cat or what you had for lunch or the position of the camera. Sometimes when TheXvidrs do that during an instructional video, it is annoying and distracting. Thanks for the great video! 👍

  • Shadow Gallery
    Shadow Gallery Year ago

    A revolution without dancing is a revolution not worth having.

  • Noldy
    Noldy Year ago

    I can watch all these videos like a movie.

  • Barry Cantrell
    Barry Cantrell Year ago

    My favorite Python professor.

  • Roshan Ali
    Roshan Ali Year ago


  • Code Bandit
    Code Bandit Year ago

    Its great tutorial. but it feels like matrix movie.

  • hytlerson
    hytlerson Year ago

    1:17 Lua indices start from 1. And there's gotta be more languages

    • Nick Bloom
      Nick Bloom Year ago

      MATLAB indicies start at 1 as well.

  • TatTvamAsi
    TatTvamAsi Year ago +1

    I wish I was famous so I can share all your videos. :( I don't have any other social media accounts and this channel deserves more subscribers.

  • Eslam Ashraf
    Eslam Ashraf Year ago

    the best tutorial ever made thankssss aloott good job

  • Paul Fuel
    Paul Fuel Year ago

    These are great videos to learn Python. Add more lectures please!

  • Nikolai Hennelund

    what script were you using?

  • Eevee
    Eevee Year ago

    This saves so much time. I like the style of these videos. :) Thanks.

  • Shuyanchi
    Shuyanchi Year ago

    cool video

  • Spencer Churchill

    yo this account is awesome

  • Uma Chaudhary
    Uma Chaudhary Year ago

    videos are very very nice

  • Abhideep Singh
    Abhideep Singh Year ago +26

    no one will believe that she is also an accomplished actor!!!

  • Universe Of Saiyan's

    Can we use add instead Of Append in list to add items,

  • Jacob Feldman
    Jacob Feldman Year ago

    Thanks so much, these are great help. You make it seem so cool!

  • bckzilla
    bckzilla Year ago +1

    I love these videos. She is so smart and so good at making it obvious.

  • Timothy Basaldua
    Timothy Basaldua Year ago

    Very Well done!
    That sound you hear is me clapping!!
    Could you please show how to use Lists to study Linear Algebra.
    No. Numpy is not allowed. I don't want Numpy to do it for me. I want to know how to do it.

  • Daniel Dias
    Daniel Dias 2 years ago +1

    What about adding to a list? Is there some add method?
    ps: the dir showed an __add__ method (with this underlines), but it doesn't seem to work

  • Shubham Bhattacharya
    Shubham Bhattacharya 2 years ago

    this is crazy... excellent work

  • Viet Nguyen
    Viet Nguyen 2 years ago

    Very creative instruction. Thanks a lot. Keep doing your great job.

  • Minasie Gessesse
    Minasie Gessesse 2 years ago

    you are truly my wonder!

  • Malini Eswarachandra
    Malini Eswarachandra 2 years ago

    You are so amazing!

  • Rajat Gupta
    Rajat Gupta 2 years ago

    You could haunt someone !

  • terminate
    terminate 2 years ago

    Dam.. Why wont this work!!!
    for line in a:
    B=input("Please enter a number")
    if B in range (a[0:21]):
    print(" not vaild for this list")
    keep getting
    TypeError: 'list' object cannot be interpreted as an integer

    • canvasMC
      canvasMC 11 days ago

      change line to this and it works. >>> if int(B) in a:

    • Socratica
      Socratica  2 years ago +2

      The input "B" is a string, not an integer. To convert it to an int you can do this:
      >>> B = int(input("Please enter a number:"))
      But be careful, it will throw an exception if the user enters a non-integer.

      Next, to see if "B" is in the list "a" use:
      >>> if B in a:
      >>> print(...

      Hope this helps!

  • Austin White
    Austin White 2 years ago +8

    freakin awesome video

  • FishBoneBogdy
    FishBoneBogdy 2 years ago +20

    I like your tutorials very much. I love that all of them aren't boring, narrated with a boring male voice which stays in front of a computer without care for life. Thumbs up and subscribe!

  • Tonderayi Kanoz
    Tonderayi Kanoz 2 years ago

    Awesome tutorial! Thumbs up.

  • Tarik AT
    Tarik AT 2 years ago +30

    your videos are really great >
    but why i feel that you'v escaped out of matrix ^_^
    anyways thanks

    • Tsog Gantumur
      Tsog Gantumur Year ago

      great and being out of matrix are not mutually exclusive

    • Psy
      Psy Year ago +1

      Maybe you are under that impression because you can use Lists to make a kind of matrix by putting lists into lists :D like example = [[0, 1,], [2, 4]] then example[1][1] is 4 ^^

  • Linyun Liu
    Linyun Liu 3 years ago

    Python is much like JavaScript.

  • Bruno Pinheiro
    Bruno Pinheiro 3 years ago +3

    the best channel of youtuber!!!!!!#socratica!!!!

  • Geli
    Geli 3 years ago +4

    I didn't understand why Python had so many data-collection data structures, until I learned other languages that didn't have nearly enough. Using an older version of JS right now on Khan Academy and I REALLY REALLY miss some dictionaries. Even having sets AND lists is suddenly a nostalgic luxury.

    • Willie Pierce
      Willie Pierce Year ago +2

      Geli keep in mind python was made mainly for data collection and studying

    NUH ZAKİR 3 years ago +5

    lol.. why does this video look like Matrix movie !!

      NUH ZAKİR 2 years ago

      hehe : )

    • terminate
      terminate 2 years ago +2

      why does this video remind me of skynet form the terminator?

  • Mac G
    Mac G 3 years ago

    Awesome. Love these videos