Тёмный
No video :(

Python string slicing ✂️ 

Bro Code
Подписаться 2 млн
Просмотров 60 тыс.
50% 1

Python string slice tutorial example explained
#python #slice() #slicing
slicing = create a substring by extracting elements from another string
indexing[] or slice()
[start:stop:step]
name = "Bro Code"
first_name = name[:3] # [0:3]
last_name = name[4:] # [4:end]
funky_name = name[::2] # [0:end:2]
reversed_name = name[::-1] # [0:end:-1]
print(reversed_name)
website1 = "google.com"
website2 = "wikipedia.com"
slice = slice(7,-4)
print(website1[slice])
print(website2[slice])
------------------------------
Up In My Jam (All Of A Sudden) by - Kubbi / kubbi
Creative Commons - Attribution-ShareAlike 3.0 Unported- CC BY-SA 3.0
Free Download / Stream: bit.ly/2JnDfCE
Music promoted by Audio Library • Up In My Jam (All Of A...
------------------------------

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

 

20 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 103   
@BroCodez
@BroCodez 3 года назад
# slicing = create a substring by extracting elements from another string # indexing[] or slice() # [start:stop:step] name = "Bro Code" first_name = name[:3] # [0:3] last_name = name[4:] # [4:end] funky_name = name[::2] # [0:end:2] reversed_name = name[::-1] # [0:end:-1] print(reversed_name) website1 = "google.com" website2 = "wikipedia.com" slice = slice(7,-4) print(website1[slice]) print(website2[slice])
@paticruz3992
@paticruz3992 Год назад
Bro!!! You are the fourth video I watched on the slice operator, they all failed to answered the questions I had. You sir, have answered all my questions! Subscribed. :)
@ChristopherRichardson-se1vb
@ChristopherRichardson-se1vb Месяц назад
Very concise. Python docs were confusing me on this and you really helped. Appreciate it.
@pc4n62004
@pc4n62004 Год назад
Thanks for explaining indexing and the slice function. I’m taking an online course and they really didn’t explain. The negative numbers I liked, followed, and commented. Keep them coming.
@mardanpallypeddamallesh2662
@mardanpallypeddamallesh2662 2 дня назад
Excellent lecture
@yc70jade
@yc70jade 2 года назад
Your videos are tremendously helpful. I've been tearing my hair out learning from a course today but your videos makes so much more sense. Thank you!
@FrigsyReynolds
@FrigsyReynolds 2 года назад
yeah I don't know the first thing about coding and all the videos I found assumed you knew the fundamentals. I even went so far as to start watching 'coding for kids' videos, but what this guy is doing is amazing! Breaking everything down from the very first steps, this dude is a legit bro.
@carolinesemele9066
@carolinesemele9066 2 года назад
Heavenly send. Clear explanation. I love your videos.
@_Aronix_
@_Aronix_ Месяц назад
😂
@dineshgautam7027
@dineshgautam7027 2 года назад
अतिसुन्दर,,,,,,,
@Dino90554
@Dino90554 3 года назад
Thank you for your RU-vid algorithm😌
@sajibmannan
@sajibmannan 3 года назад
Learned a lot. Thanks for the video.
@kawiurka
@kawiurka 2 года назад
I start to understand everything, thank you so so much :) You are really good in teaching and its great video (all of them).
@JasonJorgensonPhD
@JasonJorgensonPhD 2 года назад
excellent explanation of negative indexing in slicing section. A+
@mauricelee7299
@mauricelee7299 7 месяцев назад
Thanks for walking us through this. I am just starting to learn how to code with Python and seeing you do this was really helpful. You have a new subscriber.
@MADhatter_AIM
@MADhatter_AIM 5 месяцев назад
Nice
@famousfighter2310
@famousfighter2310 9 месяцев назад
Thanks man. Watching this right before my test
@muhiddinergashev6202
@muhiddinergashev6202 2 года назад
Good video bro
@samiemali6387
@samiemali6387 Год назад
thanks alot, this really helped
@tecc9-446
@tecc9-446 Месяц назад
nice
@user-je6cd2op2l
@user-je6cd2op2l 8 месяцев назад
Learning Python- thanks for posting-enjoyed the tutorial
@clickherenow9946
@clickherenow9946 2 года назад
Great Video
@shon7022
@shon7022 3 года назад
Is there any situation where we would need to ONLY use either indexing or slicing. Or are both interchangeable?
@harshyadav1214
@harshyadav1214 7 месяцев назад
great video
@EM-do1yi
@EM-do1yi 2 года назад
excellent tutorial !
@Mario-if5tl
@Mario-if5tl 9 месяцев назад
Thanks for sharing
@kemann3815
@kemann3815 2 года назад
Marvelous
@newperson4889
@newperson4889 Год назад
you make everything really simple to understand Bro thanks
@ubpereira
@ubpereira 2 года назад
Great vídeo bro
@CarbonST
@CarbonST 10 месяцев назад
Thanks dude the exclusive part was messing with me when I started with array.
@Daniel-du3yf
@Daniel-du3yf Год назад
Thanks Bro
@eywwhwwhatbseg
@eywwhwwhatbseg 3 года назад
Thank you bro❤️
@klemywee
@klemywee 7 месяцев назад
ez to understand. Ty!
@ACEthetics.
@ACEthetics. Год назад
bro is nice with the code
@mauipomare6523
@mauipomare6523 4 месяца назад
commenting because you asked so nicely
@edisonprendi
@edisonprendi Год назад
Learnt a lot, really thanks!
@Little_smuff_r
@Little_smuff_r 9 месяцев назад
master
@beingzero7541
@beingzero7541 2 года назад
INFORMATIVE!
@undaysmith8038
@undaysmith8038 11 месяцев назад
Awesome clip. Thanks that really helped
@ma.soishob9961
@ma.soishob9961 2 года назад
Thanks,it was a helpful tutorial
@amokranenacer5011
@amokranenacer5011 2 года назад
exlent tuto I apreciate
@yiorgoskatopodis
@yiorgoskatopodis 2 года назад
Excellent!
@youtubego5109
@youtubego5109 2 года назад
thanks i learned a lot and i hope to complete it all
@imranb5088
@imranb5088 2 года назад
thank you for the lessons!
@thorcoder1
@thorcoder1 3 года назад
You are great 👍👍😽👍🙏🙏
@minhquannguyen7494
@minhquannguyen7494 2 года назад
bro, something wrong with my code. When i copy slice=slice(7,-4), it returns str is not callable. How can I fix it? tk u
@xlpianomover2871
@xlpianomover2871 Год назад
thank you! super helpful!
@spartanranger
@spartanranger 3 года назад
Thanks for the video
@user-sp5uz9rv5n
@user-sp5uz9rv5n 2 года назад
It is great !
@SavingTheCows
@SavingTheCows 3 года назад
Thank you!
@budderrar5751
@budderrar5751 Год назад
noice
@trinityjackiewicz
@trinityjackiewicz 9 месяцев назад
Hey, thank you!! :)
@charlescarlbilly4234
@charlescarlbilly4234 7 месяцев назад
thanks bro
@headlesshair1353
@headlesshair1353 2 года назад
Thanks
@NotSpecAlt
@NotSpecAlt 27 дней назад
thnx bro!
@isaacpaikkatt267
@isaacpaikkatt267 2 года назад
cool
@ghoggaliabdou4222
@ghoggaliabdou4222 3 года назад
Thank you bocd 💙💙
@hasanteke07
@hasanteke07 2 года назад
start stop step ahh u are nice thanks
@xXxUNxXxJ00017
@xXxUNxXxJ00017 10 месяцев назад
Thx!
@SolidusPL
@SolidusPL Год назад
The entire lesson is clear and easy to understand. But I have a small question, is it possible that the index function could be set to a character such as a space or a comma and not to a letter position in a line. For example, I am doing input, please enter the first name and last name, so that index is to the first name to a space and index to the second name from a space.
@hariprashaadsr7463
@hariprashaadsr7463 Год назад
You can use find( )... name = input("Enter ur name : ") hi = name.find(" ") slice = slice(0, hi) if hi == -1 : print (f" Your first name is {name.capitalize} ") else: print (f" Your first name is {name[slice].capitalize()}") 😄
@passportbro904
@passportbro904 2 месяца назад
shout out to people that just press the like button for bros videos, just because
@jordanbuckle9146
@jordanbuckle9146 2 года назад
Try Ty
@tarikyassa1076
@tarikyassa1076 3 года назад
👍
@neeraj4210
@neeraj4210 3 года назад
❤️
@kubach2897
@kubach2897 3 года назад
Tks bro
@marshallyose8887
@marshallyose8887 2 года назад
Thanks edoC orB
@DarkAcademyUniversity
@DarkAcademyUniversity 7 месяцев назад
@gokulc7043
@gokulc7043 3 года назад
Thanks bro
@ozba
@ozba 3 года назад
perfect
@alexyakoveno4682
@alexyakoveno4682 Год назад
@oku1234
@oku1234 3 года назад
thank you
@airlanggak5391
@airlanggak5391 3 года назад
thanks!
@BAMBAMBAMBAMBAMval
@BAMBAMBAMBAMBAMval Год назад
eDoc with the orb
@tedchiu1433
@tedchiu1433 3 года назад
thanks
@jean-paulmpindumukandila1251
@jean-paulmpindumukandila1251 2 года назад
Hello I have a question with the slice function index -4 is exclusive or inclusive. Thanks
@lionbreeda2776
@lionbreeda2776 2 года назад
[1:-4] its exclusive, [-4:-2] inclusive
@verojoe1988
@verojoe1988 Год назад
Can you make a tutorial on pygame plzzz sir
@Melvishify
@Melvishify 3 года назад
Ey bro.. thanks
@user-up6jq6qn8j
@user-up6jq6qn8j 3 года назад
is your name really bro code?
@pippo9543
@pippo9543 3 года назад
bruh you really asking?
@kurtmann7595
@kurtmann7595 Год назад
youtube algorithm comment
@hostvind
@hostvind 2 года назад
now PyCharm is no more tolerant to variables' names same as the function's. So rename that "slice" var into... say, "slicee"
@nyatibros2172
@nyatibros2172 24 дня назад
Broooo
@user-ll9bg4vy2x
@user-ll9bg4vy2x 3 месяца назад
Hey Bro, I use the Google colab to program. When I'm trying to use slice function, the system told me that "'slice' object is not callable" I'm wondering why?
@tylerholland4652
@tylerholland4652 2 месяца назад
Why is it that when I write my code exactly as he does I get an error saying that 'sllice' object is not callable. In order to see it was not my fault, a copy and pasted the code exactly from the description and still got an error. I was using Google colab when I got this error but I did not get this error when I downloaded pycharm and wrote the code in there. Why?
@user-sh5zv4yf5s
@user-sh5zv4yf5s 3 года назад
Were did you learn python
@Times343
@Times343 10 месяцев назад
Bro
@mincart9899
@mincart9899 2 года назад
I think bro code eated alot of brocoli s
@sheelareddy7969
@sheelareddy7969 3 года назад
bro can you create josh clone
@darrenlouisuyangurin
@darrenlouisuyangurin Год назад
i didnt understand the output of funky_name = name[::2]. can someone explain to me pls, i understand that the default is 1 but i dont get the 2 and 3
@ilyaakradi3560
@ilyaakradi3560 Год назад
Basically, the number that you put after the second colon (the step) is how many indexes of the string the compiler will increment(or decrement by, if the value is negative) when slicing the string. In the case of funky_name, since the step value is 2, every other letter in the name is printed because the index will be going up by 2 instead of the default 1. Hope this helps.
@SuperMarioBros843
@SuperMarioBros843 Год назад
hell💀
@aaagames561
@aaagames561 4 месяца назад
t u
@realarchie9043
@realarchie9043 3 года назад
Why am I getting invalid syntax
@hostvind
@hostvind 2 года назад
It wasn't a good idea to use the name for the variable "slice" same as the function's "slice ()"
@tintingchen6558
@tintingchen6558 3 года назад
Hey bro this video no Chinese cc >
@davelaff73
@davelaff73 3 года назад
Nice
@TheKing-tj4sc
@TheKing-tj4sc 9 месяцев назад
Thanks
@asteiaellinikitv4193
@asteiaellinikitv4193 2 года назад
@maryal7502
@maryal7502 Год назад
Thanks
@AnishSaha_
@AnishSaha_ 3 года назад
Thanks
Далее
Python Decorators in 15 Minutes
15:14
Просмотров 437 тыс.
ALL 47 STRING METHODS IN PYTHON EXPLAINED
23:34
Просмотров 126 тыс.
ЛИЗА - СПАСАТЕЛЬ😍😍😍
00:25
Просмотров 1,8 млн
Python string format 💬
12:47
Просмотров 30 тыс.
Python lists, sets, and tuples explained 🍍
15:06
Просмотров 259 тыс.
Python dictionary comprehension 🕮
8:41
Просмотров 35 тыс.
String methods in Python are easy 〰️
12:06
Просмотров 95 тыс.
10 Python Comprehensions You SHOULD Be Using
21:35
Просмотров 140 тыс.
Compiled Python is FAST
12:57
Просмотров 107 тыс.
Modern Python logging
21:32
Просмотров 177 тыс.
Python list comprehension 📰
6:08
Просмотров 33 тыс.
Python 101: Learn the 5 Must-Know Concepts
20:00
Просмотров 1,1 млн