Python 3 Programming Tutorial – List Manipulation

In this Python 3 programming tutorial, we cover how to manipulate lists in Python. We are able to add things to lists by appending, we are able to remove them with del, we are able to order lists, reverse them, and more.

Sample code for this basics series:

Python 3 Programming tutorial Playlist:

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6


27 thoughts on “Python 3 Programming Tutorial – List Manipulation”

  1. Hello 🙂 Can someone help me please ? what is the code for adding whatever names a person types that will be added to the list after the program is executed ?
    In other words, i created a program that asks for your name, and it will keep on asking until you type in John, but i want the program to print out all the names you typed before you typed John.

    So far the coding is

    name = 'Curstin'
    while name != 'John':
    name = raw_input('Enter your name: ')
    Incorrect_Names = []
    print Incorrect_Names

    When you run it, it continually asks for your name but when you type in John, the list remains empty and none of the previous names are added to the list.

    If I'm not making any sense, here is the question for my assignment :

    Write a python program that takes the user input as a string. While the string is not 'John', add every string entered into a list until 'John' is entered. Then print out the list. The program should store all incorrect strings into a list in which 'John' is the only correct string.

    PLease respond ASAP and thank you !!!!

  2. just a quick one.. how do I iterate thru a list of prices of goods and run an if statement to check the prices.
    for example,
    thisList = [1000, 2000, 3000]
    for k in thisList:
    if k >= 2000:
    x = 0.2 * k
    elif k = 1000:
    x = 0.3 * k
    x = 0

    my solution of a similar problem only runs on the first element of the list n stops there… wat could I be doing wrong?

  3. I am trying to move the element of my list. When I make a copy of original list by newlist = list(mylist) and manipulate the new list, why is the value of mylist is also changing? to me, when I copy a list and make a new one, it should have a new memory location and do not touch the original list while I am changing the copied one. right? what am I missing here?

  4. using index function if there are more than 1 occurrences of them we want to get each index how can we get it

  5. Hi. Just wonder – what if I want to find indexes of all the occurences of a certain element, eg. 2 from the list in the video?

  6. Hi Harrison! How can I get around the fact that if I'm searching for the number of occurences of a given number, and said number doesn't occur in a list, the script fails to run? Thank you.

Leave a Reply