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. :)
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.
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.
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.
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()}") 😄
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?
yeah but how do you reverse a sentence, without reversing the letters within i just get this error message that its not working. im sitting here for 30 minutes now :(
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?
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.
# 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])
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. :)
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.
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!
Heavenly send. Clear explanation.
I love your videos.
😂
अतिसुन्दर,,,,,,,
Very concise. Python docs were confusing me on this and you really helped. Appreciate it.
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.
Learned a lot. Thanks for the video.
Thank you for your TH-cam algorithm😌
excellent explanation of negative indexing in slicing section. A+
I start to understand everything, thank you so so much :) You are really good in teaching and its great video (all of them).
Learning Python- thanks for posting-enjoyed the tutorial
Great video as always
Excellent lecture
Thanks man. Watching this right before my test
Thanks dude the exclusive part was messing with me when I started with array.
TQ Bro I Have To Say That You Explain The Best :)
Good video bro
you make everything really simple to understand Bro thanks
excellent tutorial !
Is there any situation where we would need to ONLY use either indexing or slicing. Or are both interchangeable?
Thanks for sharing
thanks alot, this really helped
great video
WOhooooooo BRO CODE
Thank you bro❤️
INFORMATIVE!
exlent tuto I apreciate
Marvelous
Awesome clip. Thanks that really helped
thanks i learned a lot and i hope to complete it all
Learnt a lot, really thanks!
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
Great vídeo bro
You are great 👍👍😽👍🙏🙏
Thanks,it was a helpful tutorial
Excellent!
thank you for the lessons!
I had no idea about slice function!
nice
bro is nice with the code
Thanks for the video
u r gr8
start stop step ahh u are nice thanks
thank you! super helpful!
It is great !
commenting because you asked so nicely
ez to understand. Ty!
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.
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()}")
😄
Thank you bocd 💙💙
Thank you!
bro code the goat
Nice
Hello I have a question with the slice function index -4 is exclusive or inclusive. Thanks
[1:-4] its exclusive, [-4:-2] inclusive
master
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?
Hey, thank you!! :)
Can you make a tutorial on pygame plzzz sir
thnx bro!
Thanks bro
Tks bro
🎉
Thanks
thank you
yeah but how do you reverse a sentence, without reversing the letters within
i just get this error message that its not working. im sitting here for 30 minutes now :(
perfect
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?
Ey bro.. thanks
thanks!
thanks
Were did you learn python
noice
shout out to people that just press the like button for bros videos, just because
Try
Ty
👍
now PyCharm is no more tolerant to variables' names same as the function's.
So rename that "slice" var into... say, "slicee"
❤️
Thanks edoC orB
W
eDoc with the orb
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
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.
is your name really bro code?
bruh you really asking?
bro can you create josh clone
Why am I getting invalid syntax
It wasn't a good idea to use the name for the variable "slice" same as the function's "slice ()"
I think bro code eated alot of brocoli s
Hey bro this video no Chinese cc >
Broooo
youtube algorithm comment
Bro
hell💀
Thanks Bro
Nice
Thanks
thanks bro
Thx!