Python Programming Tutorial – 13 – Slicing Lists

Part 14 – www.youtube.com How to slice lists


Comments

25 Responses to “Python Programming Tutorial – 13 – Slicing Lists”

  1. BackRaw on August 8th, 2009 10:44 am

    lol

  2. BubbaOrtiz3 on August 12th, 2009 6:28 pm

    I wana get a shirt that says Buck is my home boy…

    Print (‘Bucky is my home boy!’)

  3. mamatalu on August 15th, 2009 7:20 pm

    [m:n] can be read as starting from m, up to n (but not including n)

    Great tutorial

  4. HordeAreMyFatCousins on September 25th, 2009 4:46 pm

    del example[1:4]
    works too

  5. SiamTweet on September 27th, 2009 7:17 am

    Totally AGREE!!!

  6. Siberianhusky89 on October 4th, 2009 12:15 am

    I’m a bit confused, didn’t we learn slicing in tutorial 10?

  7. r3sp3c791 on October 6th, 2009 6:34 am

    It’s just giving u an examples of more complicated stuff.

  8. SiGhast on October 14th, 2009 12:25 pm

    Okay. So…

    Using list slicing (or regular slicing), could one make a game in which you have titles (like Warrior, Hacker, Hunter, and so forth) – and each time you level up (or something), that title change? That is, if combined with if statements (I guess)?

    Something like that.

  9. 1xXxBENxXx1 on November 7th, 2009 12:05 pm

    yea i think it would b cool to make like a MUD python game…like a text based RPG…is anybody has skype we could get together and make it…anybody got a skype?

  10. magmaguy on November 16th, 2009 11:53 am

    im precisely trying to do that but.. cant find a thing..

    I wanna do like a 2 option game but how can I make the options? it would be cool if I could do something like:

    print “A woman comes up to you and says: Hello. You are here.”
    print “Do you want to speak to her?”
    if “yes” = true print “What do you want to know?”
    if “no” = true print “Bye.”
    endif

    Whats wrong there?

  11. 1xXxBENxXx1 on November 18th, 2009 12:43 pm

    Well i can help you with that…just do this…
    Print”A woman comes up to you and says : ‘HELLO’ ”
    print “do you want to speak to her? (yes or no)”
    c = input()
    if c == ‘yes’ or ‘YES’:
    print”What do you want to know?”
    if c == ‘no’ or ‘NO’:
    print “Bye”
    for example if i give them an option to go through a door or talk to somebody.. they choose to talk to someone and i want to bring thm bck to the original Q..how do i do thatwithout rewriting tons,seroiusly is ther like a goto stmnt?

  12. izrafel1989 on December 5th, 2009 5:56 pm

    1xxxbenxxx1 i think you must put a WHILE
    and i dont know…something who change the variable in the while, and that get you out or into it….
    i mean
    humm…is a bit long to write it in here…..anyway i hope you understand me ^^ cya!!!

  13. AndoVenom on December 7th, 2009 3:54 pm

    print “A woman comes up to you and says: Hello. You are here.”
    speaktohoe = raw_input (“Do you want to speak to her? “)
    if speaktohoe == “yes” or “Yes”:
    print “What do you want to know?”
    if speaktohoe == “no” or “No”:
    print “Bye”
    gtfo = raw_input (“Leave.”)

  14. kovomaster on January 3rd, 2010 4:50 pm

    it is nice..i did something like that about 6 years ago when i tried programming for the first time. I suppose that whole game would be a large tree, but that is hardly maintainable…maybe you should try something like neuron networks or similar practiques before starting a project. good luck and have fun :-)

  15. thanhquanky on January 29th, 2010 1:57 pm

    it basically is:

    print “Hello!”
    option = raw_input(“Prompt type yes to play a game or no to quit: “)
    if (option == “yes”):
    print “Welcome”
    else:
    print “Bye”

  16. thanhquanky on January 29th, 2010 1:58 pm

    I can do it with you but at first I need to know what is MUD game =))

  17. 1xXxBENxXx1 on January 30th, 2010 1:21 pm

    It’s a text based RPG…google it bro! :D

  18. saadlulu on February 5th, 2010 2:12 pm

    LOL

  19. wamdpst on March 8th, 2010 3:48 pm

    Thank you very much.

  20. johnherter on March 26th, 2010 5:48 pm

    yeah Buck – strong work my friend.

  21. Aggregate02 on March 29th, 2010 11:48 am

    For the speaktohoe variable use the “.lower()” or the “.upper()” method to make the response into lowercase because what if the user inputs “yes” or “no” in upper case?

  22. DevilsSpawn93 on April 11th, 2010 11:58 am

    what could i put as an element in a list to make it change to a random letter/number?
    EX::
    example=list(‘putwhateverhere”)
    example[4]= <–what would i put there to make it a random change? i want it to take the specified element and change it to a random number/letter…. help??

  23. picknpac on April 14th, 2010 2:01 pm

    what if i want to add a list after the last element in the list… I tried name[-1:-1]={‘x’] but it gets added before the last character but i want to add after the last character.

  24. Shazcapade on April 27th, 2010 8:52 am

    @picknpac i didn’t really tried to use the [] but i tried to use + for this case… idk if there’s another way…

    so instead of name[-1:-1]=[x], I did name = name + list[x]

  25. Fyredragon14891 on April 30th, 2010 9:23 am

    I can’t wait to finish the tuts. Start working on projects like Frets on Fire :D

Powered by Yahoo! Answers