Bhi app ne to kmal kar dya Me Pakistani hn par app ke lecture me 8ndexing python understanding kar ke bht faida hwa he Agr c++ ,java pascal ho to wo bhi zroor seekha dn apni you tube channel par take sare lecture asani se note kar ke kuch achi programin kar skeg
I have a doubt. If you run str_name[::-1] you get the string in reveresed format. But when i try str_name[0:4:-1] note that the length of string is 4, so I'm directly giving the start as 0 and end as the total string, and the index is -1. When I run this, it doesn't work! Why? Can anyone say please?
@@Codeyug I saw the video. But when I tried this code in my idle I got differect resutls for both of them. I'm unable to figure out what's wrong with it. Here is the code >>>a='hello' >>>a[::-1] >>>'olleh' >>>a[0:5:-1] >>>'' Please test this in your pc. I'm not sure why is this happening. Thank you for replying.
@@saimanideep857 I got it. note this:- When you have negative step, default start value is -1 and not 0. It got missed in this video. But I covered it in other video, I will share the link... I need to search..
@@saimanideep857 so you are instructing python to start from 0 i.e 'h', and you need to move from left to right as step is -1, and keep running untill you reach index 5 So, you were standing at 'h' and started moving left. However, you soon realized that you had been scammed because there was no index 5 in your moving direction. This made you angry, and you decided not to print anything🗿
#slicing """slicing : slicing is used to access group of elements in string """ name = "karan singh" print(name[0:4]) print(name[:-4:-1]) print(name[0:0]) print(name[-1:-5:-3]) #len by manul program num = input("Enter a string : ") counter = 0 for i in num : counter+=1 print(counter) #by len() func num = input("Enter a string : " ) print("Entered string length is :", len(num)) #string membership #Two membership operator : in , not in name = "karan singh" if "k" in name : print ("yes it is true") else: print("false") name = "karan singh" if " " in name : print ("yes it is true") else: print("false")