Python Tutorial for Beginners 8 – Python Slices or Slicing

///Python Tutorial for Beginners 8 – Python Slices or Slicing

Python Tutorial for Beginners 8 – Python Slices or Slicing

FavoriteLoadingAdd to favorites

In this video I am going to show How to use Slice function or slicing with Python Collections. Also I am going to show how to use Negative index with Python Collections. So What is Python Slice? A slize is a span of items that are taken from a sequence
List slicing format: list[start : end: step]. Span is a list containing copies of elements from start up to, but not including, end
If start not specified, 0 is used for start index. If end not specified, len(list) is used for end index. Slicing expressions can include a step value and negative indexes relative to end of list.
And What is Negative Indexing In Python: I a Python Collection such as Lists, Strings, Tuples, Bytes .. we can refer to an element by a negative index representing how far it is from the end.
example
# +—+—+—+—+—+—+
# | P | y | t | h | o | n |
# +—+—+—+—+—+—+
# 0 1 2 3 4 5 —- Positive Index
# -6 -5 -4 -3 -2 -1 —- Negative Index

★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ ⚫️
Java Programming Course ➡️ ⚫️
Bash Shell Scripting Course ➡️ ⚫️
Linux Command Line Tutorials ➡️ ⚫️
C Programming Course ➡️ ⚫️
C++ Programming Course ➡️ ⚫️
PHP Programming Course ➡️ ⚫️
Android Development Course ➡️ ⚫️
C# Programming Course ➡️ ⚫️
JavaFx Programming Course ➡️ ⚫️
NodeJs Programming Course ➡️ ⚫️
Jenkins Course For Developers and DevOps ➡️ ⚫️
Scala Programming Tutorial Course ➡️ ⚫️
Bootstrap Responsive Web Design Tutorial ➡️ ⚫️
MongoDB Tutorial Course ➡️ ⚫️
QT C++ GUI Tutorial For Beginners ➡️

★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare –
Data Science – |
Machine Learning – |
Artificial Intelligence – |
MERN Stack E-Degree Program – |
DevOps E-degree – |
Data Analytics with R – |
AWS Certification Training – |
Projects in Java – |
Machine Learning With TensorFlow – |
Angular 8 – Complete Essential Guide –
Kotlin Android Development Masterclass –
Learn iOS Programming Building Advance Projects –

★★★ Follow ★★★
My Website –

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

– Python Slices
python tutorial for beginners pdf
python tutorial for beginners with examples
best python tutorial for beginners
python tutorial for beginners ppt
python tutorial for beginners video
basic python tutorial for beginners
learn python tutorial
Verwandte Suchanfragen zu python slices
python string multiple lines
python slice list
python string slice
python länge einer liste
python multiple assignment
python string to tuple
python string abschneiden
python compare tuples

source

By |2019-12-17T00:36:43+00:00December 17th, 2019|Python Video Tutorials|33 Comments

33 Comments

  1. ProgrammingKnowledge December 17, 2019 at 12:36 am - Reply

    I have created the New Course on Python – Please Chick to View https://www.youtube.com/playlist?list=PLS1QulWo1RIYt4e0WnBp-ZjCNq8X0FX0J

  2. Vinodh Kumar Rajasekaran December 17, 2019 at 12:36 am - Reply

    Thank You Sir, easily understood

  3. Soumyadeep Barik December 17, 2019 at 12:36 am - Reply

    It should be given only "b" to the response of [2:3] . And in response of [2:4] , it yields "b" & "c" but it yields "c" & "d" how can it be possible?

  4. Rawan Al-daneen December 17, 2019 at 12:36 am - Reply

    thank you

  5. Harkesh Sharma December 17, 2019 at 12:36 am - Reply

    Nice way u explained boss.

  6. Hello Programmer December 17, 2019 at 12:36 am - Reply

    why python skips the value b 1 ?

  7. Mounika Bathina December 17, 2019 at 12:36 am - Reply

    What is Keyboard Interrupt ?

  8. Lt. Riku December 17, 2019 at 12:36 am - Reply

    this is more like using terminal in linux than programming nice tutorial u explain so much i really appreciate for it

  9. achintya agarwal December 17, 2019 at 12:36 am - Reply

    @ProgrammingKnowledge :- myList[ : : -1] outputs the complete list in reverse . But when I enter myList[9:0:-1] It Leaves the first number, which it correctly should since it is on index 0…. but myList[9:-1:-1] doesn't return anything….. so what is correct arguments to pass in order to get the index 0 number as well.

  10. Fathima Jesrin December 17, 2019 at 12:36 am - Reply

    its useful to us till now …. love it

  11. aman December 17, 2019 at 12:36 am - Reply

    can i fuck this udemy ad girl in her mouth

  12. satyam singh December 17, 2019 at 12:36 am - Reply

    how to remove the index term from the playlist?

  13. Shankar Muthu samy December 17, 2019 at 12:36 am - Reply

    Hi, very good tutorial. Thank you.
    I have tried this also mylist[ : : 0] will give us error since slice step cannot be zero.
    And I will keep watching your video. Really helpful.

  14. vivek pannu December 17, 2019 at 12:36 am - Reply

    for better experience , efficiency and speed watch at 2 times the original speed and i believe most of you will be able to withstand but for those of you who can't take this speed (assuming it's fast which it isn't) after some time(2 minutes) slow down to 1.5 and that will be easily understandable

  15. Rajashekar Narayana December 17, 2019 at 12:36 am - Reply

    Guruji, thanks for your videos, its really helping me a lot although I am not a techie

  16. nitesh srivastava December 17, 2019 at 12:36 am - Reply

    mylist=[1,2,3,4,5,6,7,8,9]
    typed
    mylist[–2:-4] #two minus sign before 2
    output : [3,4,5]

  17. rajkumar kushwaha December 17, 2019 at 12:36 am - Reply

    it is not necessary to print till end we need to give mylist[4:10]
    even we give mylist[4:29], it will give same answer.
    my way seems to be rude but i am simply identifying different ways and bluntly typing is down

  18. BIRAT ADHIKARI December 17, 2019 at 12:36 am - Reply

    you r too slow with ur speech.work on it plzz

  19. Zulfi Aman December 17, 2019 at 12:36 am - Reply

    Thanks for doing this work

  20. Vijay Kumar December 17, 2019 at 12:36 am - Reply

    nice explanation..its really helpful

  21. Simran Knight December 17, 2019 at 12:36 am - Reply

    💛❤️💙💚💜💙

  22. Hera Hassan December 17, 2019 at 12:36 am - Reply

    Great Tutorial.
    Thanks and Regards.

  23. neerajn1911 December 17, 2019 at 12:36 am - Reply

    Also, using negative list, I could never print 9 in mylist.
    print(mylist[-10 : -1]) gives an output as [0,1,2,3,4,5,6,7,8]
    print(mylist[-10 : 0]) gives an output as [ ]
    print(mylist[-10 : -2] gives an output as [0,1,2,3,4,5,6,7]
    print(mylist[0 : -1]) gives an output as [0,1,2,3,4,5,6,7,8]

    Is there a solution or i would never be able to print mylist[9] using -ve list ?

  24. neerajn1911 December 17, 2019 at 12:36 am - Reply

    Great job ProgrammingKnowledge!!
    I think I found a minor bug in Python related to this lesson.
    When you print(mylist[9:11]), it prints 9, however names[11] is out of range. I was hoping for an error but it didn't throw any. If I try to explicitly print(mylist[11]), it does throw an error !!

  25. Sam Cs December 17, 2019 at 12:36 am - Reply

    Hats off to "ProgrammingKnowledge". You have done a great job. You made the programming piece of cake for beginners and boost their confidence in learning programming. I have watched and learnt programming by watching your videos. They are great. 🙂

  26. Pravin Baste December 17, 2019 at 12:36 am - Reply

    Thanks bro..!!!
    You are doing really awesome work…!!
    Learned a lot from your videos..!!!

  27. Ishan Chourey December 17, 2019 at 12:36 am - Reply

    in v3.6.1, when i use slice, the first digit is not included,
    ex is i used mylist[4:7], i a.m getting result as 5,6,7
    can anyone clarify on it

  28. Nagarkoti Snow warrior December 17, 2019 at 12:36 am - Reply

    i think in case of [-4:-2]it will first goes to -4 from the end and then print diff of given no value i.e(in this case it will print 2 values as 4-2=2 )starting from -4 value.

  29. jitendra kumar December 17, 2019 at 12:36 am - Reply

    how to use slice in a list containing [0,1,2,3,4].Here I want tp print only 4 using slicing.How is it possible can any one help on this.

  30. Anujmonty December 17, 2019 at 12:36 am - Reply

    modi modi modi😁

  31. Sofía Childress December 17, 2019 at 12:36 am - Reply

    thank you formaking these! they are such a great help!!!!!! 🙂

  32. Astro Astra December 17, 2019 at 12:36 am - Reply

    he is wrong in saying this " : " –> semi colon ,,, observe it..!!

  33. saurabh bhathiza December 17, 2019 at 12:36 am - Reply

    sir, can u please explain the concept of 6:54, i am not able to get that.

Leave A Comment

*