Тёмный

Python Tutorial for Beginners 17 - Python Slice and Negative index 

ProgrammingKnowledge
Подписаться 1,8 млн
Просмотров 30 тыс.
50% 1

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
#PythonTutorialforBeginners #ProgrammingKnowledge #LearnPython #PythonCourse
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ bit.ly/2vsuMaS ⚫️ bit.ly/2GOaeQB
Java Programming Course ➡️ bit.ly/2GEfQMf ⚫️ bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ bit.ly/2DBVF0C ⚫️ bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ bit.ly/2IXuil0 ⚫️ bit.ly/2IXukt8
C Programming Course ➡️ bit.ly/2GQCiD1 ⚫️ bit.ly/2ZGN6ej
C++ Programming Course ➡️ bit.ly/2V4oEVJ ⚫️ bit.ly/2XMvqMs
PHP Programming Course ➡️ bit.ly/2XP71WH ⚫️ bit.ly/2vs3od6
Android Development Course ➡️ bit.ly/2UHih5H ⚫️ bit.ly/2IMhVci
C# Programming Course ➡️ bit.ly/2Vr7HEl ⚫️ bit.ly/2W6RXTU
JavaFx Programming Course ➡️ bit.ly/2XMvZWA ⚫️ bit.ly/2V2CoAi
NodeJs Programming Course ➡️ bit.ly/2GPg7gA ⚫️ bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ bit.ly/2Wd4l4W ⚫️ bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ bit.ly/2PysyA4 ⚫️ bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ bit.ly/2DFQ2yC ⚫️ bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ bit.ly/2LaCJfP ⚫️ bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - skillshare.eqc...
Data Science - bit.ly/2lD9h5L | bit.ly/2lI8wIl
Machine Learning - bit.ly/2WGGQpb | bit.ly/2GghLXX
Artificial Intelligence - bit.ly/2lYqaYx | bit.ly/2NmaPya
MERN Stack E-Degree Program - bit.ly/2kx2NFe | bit.ly/2lWj4no
DevOps E-degree - bit.ly/2k1PwUQ | bit.ly/2k8Ypfy
Data Analytics with R - bit.ly/2lBKqz8 | bit.ly/2lAjos3
AWS Certification Training - bit.ly/2kmLtTu | bit.ly/2lAkQL1
Projects in Java - bit.ly/2kzn25d | bit.ly/2lBMffs
Machine Learning With TensorFlow - bit.ly/2m1z3AF | bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - bit.ly/2lYvYRP
Kotlin Android Development Masterclass - bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - www.codebind.com
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!

Опубликовано:

 

11 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 16   
@ProgrammingKnowledge
@ProgrammingKnowledge 6 лет назад
Gist of all the commands I used in this video gist.github.com/pknowledge/b5a9c117672078a4c1bd68cbb596dc6c
@cley.
@cley. 3 года назад
Hey, for me when I use the slice method, for example the list a=[1,2,3,4,5,6,7] p=slice(2,5) a(p) gives [3,4,5] it doesn't give the 2, but provides the stop 5, not sure why.
@danieloliveira9815
@danieloliveira9815 4 года назад
The thing that I like about python is that it is very intuitive and a lot of the functions that it has actually makes sense. The slice() function works actually like a slice of something... a slice of cake for example :v
@davvoprod.851
@davvoprod.851 6 лет назад
Thank you bro for great job!
@qzorn4440
@qzorn4440 5 лет назад
Great Slice video.
@oddity4650
@oddity4650 4 года назад
I got confused on that -3 thing so you mean it stops at - 3 so 7, so it dont print 7 as it is like a stop sign?
@adamnoomene8659
@adamnoomene8659 2 года назад
thanks man
@swagatbaruah522
@swagatbaruah522 5 лет назад
confusing
@Anirudh959
@Anirudh959 4 года назад
How can you slice tuples when there is no indexing in tuples ?
@mohanned4020
@mohanned4020 6 лет назад
1st comment 💜
@PrakashKumar-pf5st
@PrakashKumar-pf5st 2 года назад
sir please make dsa in python video lecture .
@cornpopthebaddude3992
@cornpopthebaddude3992 4 года назад
I would have liked to watch the ending of the video but you blocked the whole screen with links to other videos so I won't be watching any of those other videos now .
@kartheekreddyjonnalagadda1605
@kartheekreddyjonnalagadda1605 6 лет назад
Where is 16
@dilucide
@dilucide 6 лет назад
Shouldn't this be titled as episode 17?
@khanzahidrasheedraja8026
@khanzahidrasheedraja8026 Год назад
got nothing
Далее
Python Tutorial for Beginners 18 - Python while Loop
10:16
Python Decorators in 15 Minutes
15:14
Просмотров 441 тыс.
Apple Event - September 9
1:38:50
Просмотров 25 млн
Coding Was HARD Until I Learned These 5 Things...
8:34
25 nooby Python habits you need to ditch
9:12
Просмотров 1,7 млн
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
Python for Beginners - Learn Python in 1 Hour
1:00:06
Просмотров 18 млн
#64 Python Tutorial for Beginners | MultiThreading
14:45
Apple Event - September 9
1:38:50
Просмотров 25 млн