Тёмный

Strings Slicing and Operations on Strings in Python | Python Tutorial - Day #12 

CodeWithHarry
Подписаться 6 млн
Просмотров 764 тыс.
50% 1

Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.
Access the Playlist: • Python for Beginners (...
Link to the Repl: replit.com/@codewithharry/12-...
Join Replit the browser-based IDE used in this course - join.replit.com/code-with-har...
►Checkout my English channel here: / @programmingwithharry
►Instagram: codewithharry
python, C, C++, Java, JavaScript and Other Cheetsheets [++]:
Playlist: • Coding CheatSheets 🧾 b...
►Learn in One Video[++]:
Python[15 Hr]: • Python Tutorial For Be...
Python Advance[3.5 Hr]: • Python Programming Cou...
Python[1 Hr]: • Learn Python In Hindi ...
Python[2 Hr]: • Python Tutorial In Hin...
Python[15 Min]: • 15 Minute Python Tutor...
JavaScript[1 Hr]: • JavaScript Tutorial
C[1.3 Hr]- • C Programming Tutorial...
php[1 Hr]: • Learn Php In One Video...
php[2.3 Hr]: • Php Tutorial for Begin...
php[Project]- • Login And Registration...
HTML[30 Min]: • HTML 5 Tutorial For Be...
CSS[8.5 Hr]: • CSS Tutorial In Hindi ...
CSS[1.4 Hr]: • CSS 3 Tutorial For Beg...
Wordpress[3.2 Hr]: • How To Make a WordPres...
Angular[2 Hr]: • Angular Tutorial in Hindi
Java[2.3 Hr]: • Java tutorial in hindi 🔥
Web Scraping[1 Hr]: • Web Scraping Tutorial ...
MongoDB[2 Hr]: • MongoDb Tutorial For B...
Numpy[1 Hr]: • Numpy Tutorial in Hindi
Android Dev[12 Hr]- • Android Development Tu...
Linux[1 Hr]: • Linux Tutorial For Beg...
JQuery[1.1 Hr]: • jQuery Tutorial For Be...
Git and GitHub[1.1 Hr]: • Git & GitHub Tutorial ...
►Complete course [playlist]:
React: • React Js Tutorials in ...
Python- • Python Tutorials For A...
OOP Python- • Object Oriented Progra...
Java: • Java Tutorials For Beg...
JavaScript- • JavaScript Tutorials I...
PHP- • PHP Tutorials in Hindi
C- • C Language Tutorials I...
C++- • C++ Tutorials In Hindi
Git & GitHub- • Git and GitHub Tutoria...
Android Dev- • Android Development Tu...
Python GUI- • Python GUI: Tkinter Tu...
Web Development- • Web Development Tutori...
Python Django: • Python Django Tutorial...
Projects Using HTML, CSS & Javascript- • Projects Using HTML, C...
Data Structure and Algo: • Data Structures and Al...
Follow Me On Social Media
►Website (created using Django Rest & Angular): www.codewithharry.com
►Facebook: / codewithharry
►Instagram: / codewithharry
Twitter: / codewithharry
Comment "#HarryBhai" if you read this 😉😉

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

 

8 дек 2022

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1,9 тыс.   
@arslanahmed6996
@arslanahmed6996 8 месяцев назад
nm="Harry" print(nm[-4:-2]) *The length of the string is 5, and the order of characters starts from zero, so H(0), a(1), r(2), r(3), y(4). Back to the code; (len(nm)-4-->5-4=1 (len(nm)-2-->5-2=3 *Hypothetically new statement is print(nm[1:3]) we know the starting point is 1, but to access the character's order we use n-1 principle. So, order of character=n-1 OC=3-1=2 Take the order of characters from 1 to 2 from the actual string; hence, the output is (ar).
@tafseerahmad7383
@tafseerahmad7383 7 месяцев назад
keep going , i was there , trying to explain myself exactly like this. and harry bhai especially asked not to comment the solution 😂😂
@btsmeus7503
@btsmeus7503 7 месяцев назад
Ohh thanks for explaining i was lil confused bu i understand now 😊
@meet_gajera2992
@meet_gajera2992 6 месяцев назад
Sir output nahi aayega
@onelottrader07
@onelottrader07 5 месяцев назад
bro output is n-1=>1-1=0 and n-1=>3-1=2, so output is HR
@shahali701
@shahali701 5 месяцев назад
aray kehna kia chahty hoo??? 😄
@sanskar_626
@sanskar_626 Год назад
I haven't installed Instagram!! Ans= ar Here, print(nm[-4:-2]), means that, nm is of 5 characters therefore 5-4= 1, and 5-2= 3.... It will be like this •print(nm[1:3]), including 1 and not 3!! Thanks HarryBhai! #100 days of code
@Chicken-cn2cn
@Chicken-cn2cn Год назад
Same even I don't have intra 😶
@Webseries12391
@Webseries12391 Год назад
Right answer = ar
@yogendersingh741
@yogendersingh741 Год назад
@@Webseries12391 er is right ans !!!!
@aryankoul1238
@aryankoul1238 Год назад
@@yogendersingh741 e kidher hai bhai
@parulsharma274
@parulsharma274 Год назад
Answer is ar bcz Nm="harry" Print(nm[-4: -2] ) We can write as .. Print(nm[1:3]).. Index 1&2 is ar Answer hoga
@user-ds4cr9cl6y
@user-ds4cr9cl6y Год назад
10:38 / 11:47 THE OUTPUT WILL BE = "ar"' thank you harry bhai for this amazing course .😃
@nj7787
@nj7787 10 месяцев назад
Badiya
@parasmanhas599
@parasmanhas599 10 месяцев назад
yes ,my output is also ar
@honey_bunny00
@honey_bunny00 10 месяцев назад
How?
@aarushisachdeva6598
@aarushisachdeva6598 10 месяцев назад
Kaise aaya
@nj7787
@nj7787 10 месяцев назад
Acche se padho tab result aayega
@sohailnawaz186
@sohailnawaz186 Год назад
Lecture revision: strings are just like an array of characters so we can access each of those characters. len(obj) gives the total length. to splice a string code is string[0:5]. 0 can be omitted, 5 if omitted will result in complete string be printed. negative splicing means that it will subtract the index from total length of string . string[0:-3]
@narutokun203
@narutokun203 Год назад
ek doubt hai last mein jo looping wala command hai usme "i" kyu likha hai
@octetgaming3561
@octetgaming3561 Год назад
@@narutokun203 i jaruri nhi h likhna kuch ur bhi likh skte h, its just a variable . like for x in alphabet or for y in alphabet
@hacker-ov6yc
@hacker-ov6yc 11 месяцев назад
@@octetgaming3561 bro muj samaj nahi aya last question please guide how to solve easy way
@user-ke5lf6ge7c
@user-ke5lf6ge7c 11 месяцев назад
@@hacker-ov6yc que :- print(nm[-4:-2]) ans :- python order = h = 0 , a = 1 , r = 2 , r = 3 , y = 4 number order = h = 1 , a = 2 , r = 3 , r = 4 , y = 5 putting 5 before each number ( -4 and -2 ) becoz total character in harry are 5 equation = print ( nm [ {5}-4 : {5}-2 ] ) solve = print ( nm [ 1 : 3 ] ) # 5 - 4 = 1 and 5 - 2 = 3 Now, at first place in the name harry (by python order ) is >a< , and, at third place in the name harry (by number order) is >r< NOTE :- the ratio ( 1:3 ) is given in this order = ( python order : number order ) So, That's why it prints ( ar ) in the output I hope it would be helpful to you😅
@kabirgangwani7558
@kabirgangwani7558 10 месяцев назад
@@hacker-ov6ycbhai dekh minus wale mai jo bhi string ki lenght h us sai minus krdo jo number aaye after Substraction vo print hojayenge for example jo sir nai question diya tha harry wala usmai string lenght 5 h bcoz harry is a 5 characters string . So 5-4 : 5-1 aisa hoga .
@vickyaryanvlog
@vickyaryanvlog Год назад
Day #12 done! Thanks to Almighty I was able to complete today's lecture even though I'm very sick right now.
@lalit052
@lalit052 Год назад
me too bro
@ErenYeager-jr2ht
@ErenYeager-jr2ht Год назад
R u asking for sympathy?
@mohammadnaseer5413
@mohammadnaseer5413 Год назад
@@ErenYeager-jr2ht I think he @Vicky Aryan Vlog wants to motivate all those who became irregular because of sickness and also he is thankful for he didn't lost his consistency even when he was sick.
@kaushik_herle
@kaushik_herle Год назад
Health is Wealth. Don't Compramise.
@krishnakumarkumar5710
@krishnakumarkumar5710 Год назад
@@ErenYeager-jr2ht huggu Bhai..
@anuragsingh-099
@anuragsingh-099 Год назад
1st time koi playlist consistently follow kr rha hu roj 15 minute To see the power of consistency what I achieve after 100 days 🔥🔥🔥
@glowingfunonly3758
@glowingfunonly3758 Год назад
Me too bro
@user-ct5pl5lx8j
@user-ct5pl5lx8j Год назад
100 दिन बाद क्या समझ आया ईमानदारी से बताना?
@shubhpandey8485
@shubhpandey8485 11 месяцев назад
kuch bhi nahi 🥺@@user-ct5pl5lx8j
@debasishbesra2901
@debasishbesra2901 Год назад
Day3 of #100DaysOfCode. In this video 12, I learned about string slicing and operations in Python. I discovered how to find a string's length using the len() function, access characters with indices, and perform slicing to extract parts of a string. Additionally, I learned that strings are iterable arrays, allowing me to loop through their characters. Thank You Harry Bhaiya.
@alizaawan148
@alizaawan148 10 месяцев назад
hii ! are you know how run new file in replit? like i know how to create but i cant run my new file
@atharvarai163
@atharvarai163 Год назад
This tutorial on string slicing is good than the previous one I kinda understand negative indexing better. Thanks a lot.
@Rimham-p7g
@Rimham-p7g Год назад
same bro ... 😍😇
@lovehumanity489
@lovehumanity489 Год назад
Have gone through your previous Python lectures too...but this time apart from your way to teach your video presentation is awesome....kudos to you and your editing team.....I am so happy to watch u n the family growing....keep up the good work sir.
@lazydong8547
@lazydong8547 Год назад
Complete 🙌 Thank you bhaiya♥ You are the best.
@nishantbisht9985
@nishantbisht9985 9 месяцев назад
Vid 12 of the series and i feel like I'm really getting a hand of coding now... it's been 4 days since I started watching this playlist and I'll be continuously posting
@sasmitasmaranika7812
@sasmitasmaranika7812 Год назад
Thank u Sir for this amazing session 🙏🙂
@richit7503
@richit7503 Год назад
I don't have an instagram account so I'm posting answer here. print(nm[-4:-2]) gives "ar" It's because len (nm) = 5 Then nm[-4:-2] = nm[1:3] This will give us 1st and 2nd character from the string
@SuperPakistaniii
@SuperPakistaniii Год назад
1 will be included
@chotemotereporter6685
@chotemotereporter6685 Год назад
@@SuperPakistaniiiyes
@latestknowledge2min.booste456
@latestknowledge2min.booste456 11 месяцев назад
I think so but after running is giving only "a" why??
@200009rahul
@200009rahul 11 месяцев назад
no its "arr"
@SaiSrivastava7
@SaiSrivastava7 10 месяцев назад
​@@200009rahulNo only "ar"
@dineshsoni397
@dineshsoni397 Год назад
@Dine Vlogs Present Harry Bhaiya 😊😊 The input is :- nm = "Harry" print(nm[-4 : -2]) Out put= ar EXPLANATION :-- Because the length of word is 5(H a r r y) 5-4 = 1 start counting to zero(0) 1= a Second 5-2 = 3 start counting to zero(0) 3= r
@RohitPaikrao
@RohitPaikrao Год назад
good bro
@user-dh6gd1wv2t
@user-dh6gd1wv2t 5 месяцев назад
Thank you very much! It is very easy to follow and access this challenge!
@moosamigration4346
@moosamigration4346 Год назад
According to my calculation the answer of this would probably be "ar" because first we would minus 4 with 5 and remainder will be "1". and when 5-2 = 3. The word harry contain 4 letters and when we count the answer will be "ar". That's the reason behind it
@amitranjeetjha1240
@amitranjeetjha1240 Год назад
This course is awesome 🔥🔥
@rocky3965
@rocky3965 Год назад
Hi harry bhaiya , i completed your C Language full course which was great and easy to understand. Now i am doing this course as i want to learn AI . You are the best i should say in teaching of Programming . Thanks a lot for all that you are giving us free of cost also in "Desi bhasha".❤
@Zeeshansikandar.
@Zeeshansikandar. 11 месяцев назад
A am also learn python for my ai project.can we do help each others.
@shahzaibk2806
@shahzaibk2806 11 месяцев назад
i am also @@Zeeshansikandar.
@horizon9370
@horizon9370 11 месяцев назад
​@@Zeeshansikandar.I am From AI branch I can help ..i am too working on a project
@bikashtamang9756
@bikashtamang9756 11 месяцев назад
@@horizon9370 what kind of project you are working on?? I am a prompt engineer
@user-jc1tw6dh3f
@user-jc1tw6dh3f 9 месяцев назад
great work Harry Bhai... keep rocking ... keep guiding us..
@Nirmala_life_story
@Nirmala_life_story 11 месяцев назад
Day 12. Thank you so much Harry Bhaiya for this free course. And I will see you NeXT time
@Scientist_Ritik_Tiwari
@Scientist_Ritik_Tiwari Год назад
Great bro.. Well-done 🙌🏻❤️👍
@navinvishwakarma3312
@navinvishwakarma3312 6 месяцев назад
Output : AR
@San-Deve
@San-Deve 4 месяца назад
Output: ar As in the string Harry the 2nd & (4-1)th number is in lowercase
@ProNinja-wz9lg
@ProNinja-wz9lg 4 месяца назад
Ar
@piyushsen9017
@piyushsen9017 Месяц назад
ar
@piyushsen9017
@piyushsen9017 Месяц назад
@navinvishwakarma3312 AR and ar both are different python is a case sensitive language be carefull😅
@ctp2687
@ctp2687 19 дней назад
Caps lock kaha se aya
@newcreation3411
@newcreation3411 2 месяца назад
These are really helpful, Thanks a lot for this course, loving it so far.
@haseebhaider4301
@haseebhaider4301 5 месяцев назад
thanks Harry for your Informative and responsive videos😊
@priyxnshu2007
@priyxnshu2007 Год назад
100th comment🔥🔥 Thank you very much harry bhaiya I am in class 9 and I have become a hero of coding in my school just because of you..
@Manu-rt3mp
@Manu-rt3mp Год назад
o lol same case here
@priyxnshu2007
@priyxnshu2007 Год назад
@@Manu-rt3mp hehe boi
@irammahmood2792
@irammahmood2792 8 месяцев назад
Watching this playlist from Pakistan. Your way of explaining is way easier and understandable than others. Your efforts and content are worth mentioning. You tell everything bit by bit in easy words. Thanks for teaching and giving us your time. You deserve a compliment. 😄
@nightopia2911
@nightopia2911 8 месяцев назад
did you learned it?
@ajaybhaygude.1386
@ajaybhaygude.1386 Год назад
Great explanation of a negative slicing, help me alot😍❤
@Anshuman_1029
@Anshuman_1029 Год назад
#Quickquiz Answer - ar Explanation - len(nm)=5 5-4:5-2 gives 1:3 python will only give till second index i.e. ar #Harrybhai
@sanjayray9309
@sanjayray9309 Год назад
@@crazyboyrish2577 Watch again this video.
@sanjayray9309
@sanjayray9309 Год назад
Right
@santosh_soni_
@santosh_soni_ Год назад
@@crazyboyrish2577 slicing formula string[start :end-1] "Harry"[1:3] Ar
@adnanshinwari70
@adnanshinwari70 11 месяцев назад
Hey harry bhai. Do you have a pdf or a written version of all the written tutorials you show on replit?
@divyanshutiwari5450
@divyanshutiwari5450 25 дней назад
nm = "Harry" 01234 print(nm[-4:-2]) will be equal to 5 - 4 = 1 and 5 - 2 = 3 [1:3] that is " ar " as 1 will be count and 3-1 will be counted. Thank you Harry Bhai🤝
@mr.electron5295
@mr.electron5295 Год назад
i have seen your other tutorial's on python too but sir u are taking this one on next level thank u somuch for this series
@digitaldev1717
@digitaldev1717 Год назад
hey bro Jo harry sir theory padhate hai replit me wo kaise milegi plz tell me bro.🙏
@mr.electron5295
@mr.electron5295 Год назад
@@digitaldev1717 sure sir first click on the link of the repil given in disciption of the video from there u will be redirected to todays repl there u can see file name --> .tutorial it the the file with theory
@noobdestroyer6964
@noobdestroyer6964 Год назад
It will print ' ar' because when we followed the syntax of print(nm[-4:-2]) t the value of nm is harry so python interpreter subtracts
@riffxo
@riffxo Год назад
5-4=1 so it will print "a" and 5-2= 3 so it prints "r", a and r are printed together
@peterisfamilyguy
@peterisfamilyguy 11 месяцев назад
​@@riffxoit will be h,a
@Agrim3214
@Agrim3214 8 месяцев назад
the answer is ar because 5-4: 5-2 which is equals to 1:3 and as the third index is ignored and starts from 0 your output is "ar". and thank you for your nice explanation .
@iqnazir597
@iqnazir597 Год назад
Great teacher , Great work
@AbdulSalam-pv6es
@AbdulSalam-pv6es Год назад
Day #12 Completely Done and Understood!!
@user-un1rb1es2c
@user-un1rb1es2c Год назад
nm = "Harry" print(nm[-4:-2]) The variable nm is assigned the string "Harry". The print() function is then used to display a portion of the string using slicing. Slicing is a way to extract a substring from a string in Python. It uses the syntax string[start:end], where start is the index of the first character you want to include in the substring, and end is the index of the character after the last character you want to include in the substring. In this case, nm[-4:-2] represents a slice of the string nm: start = -4: The index -4 corresponds to the 4th character from the end of the string. In this case, it is "a". end = -2: The index -2 corresponds to the 2nd character from the end of the string. In this case, it is "r". So, the slice nm[-4:-2] includes all characters from the 4th character from the end ("a") up to, but not including, the 2nd character from the end ("r"). The result of print(nm[-4:-2]) will be the substring "ar". It is important to note that slicing in Python includes the starting index but excludes the ending index. Therefore, the character at index -2 ("r") is not included in the result. The slice includes characters at indices -4 and -3 ("a" and "r", respectively).
@supeverse1712
@supeverse1712 11 месяцев назад
kitna bada nalla h tu pata chal gya
@SmartestCat1
@SmartestCat1 11 месяцев назад
itna nhi likhna hota
@bikashtamang9756
@bikashtamang9756 11 месяцев назад
par bhai waha par sirf 4 hi character hein ne?? h=0 a=1 r=2 r=3 y=4 0 sy surur hota hein na??
@onkar5404
@onkar5404 10 месяцев назад
= chatgpt
@adityapradhan8474
@adityapradhan8474 Год назад
Helpful video lecture - Better than udemy
@riddhitiwari5564
@riddhitiwari5564 4 месяца назад
Thank you bhaiya bahut acha sikha rhe h aap 🙏👍
@shubhamsaini4871
@shubhamsaini4871 Год назад
Yesterday, I was clever. So i wanted to change the world. Today, I'm wise, So I'm changing myself - Rumi
@vlogging_yogish
@vlogging_yogish 4 месяца назад
bhai aap best teacher hein
@SoumyadipDas-ob6ui
@SoumyadipDas-ob6ui 2 месяца назад
nm="harry" print(nm[-4:-2]) sring ka length =5 so 5-4=1 and 5-2 =3 order of character stars from 0 so print(nm[1:3]) including 1 and not 3 The output is "ar"... thank you for this amazing video #Day 12 complete
@Freak6318
@Freak6318 Год назад
nm = "Harry" print(nm[-4 : -2]) #1:3 output : ar
@zainabazeemazeem7641
@zainabazeemazeem7641 7 месяцев назад
Day 12 completed 👍
@raghvendra5421
@raghvendra5421 Год назад
Proud to myself For my consistency 🙂 #Day12 Present
@raghvendra5421
@raghvendra5421 Год назад
@@sachinkaxhyap 😂nice Unfortunately my boards are coming, I I'll also do the same thing after my boards
@ParshwaShah-cr8ju
@ParshwaShah-cr8ju 3 месяца назад
harry bhai bahot achha sikhate ho thanks for giving this tutorial ese tutorial banate raiye bhai 😁😁😁😁
@user-qu4mo9bw6d
@user-qu4mo9bw6d 3 месяца назад
Bro has great explanation skill.everyone has to admire him for that❤.Lots of love bro
@nahiarabeer9565
@nahiarabeer9565 Год назад
Only 88days left I'm very excited 😍😍
@payaraislam7867
@payaraislam7867 Год назад
nm = "Harry" print(nm[-4:-2]) out put will be "ar" because 5-4=1 and 5-2=3 so [1:3]= ar
@TheWolf9777
@TheWolf9777 2 месяца назад
When you guess the correct answer, and then code it and check, "It's correct" and the end music plays! feels like magic
@user-lg9sy7cr4t
@user-lg9sy7cr4t 28 дней назад
# Quick quiz nm="Harry" print(nm[-4:-2]) # total length 5 # 5-4=1 # a sa shuru ho ga 1 sa aga gina cursor dekh ka # 5-2=3 three sa aga nhi gina jai ga # answer is ar sir present lots of love from pakistan sir g answer phla comment ma likha phir run kr liya tha thank you theekn answer aya mara
@utkarshsahay9908
@utkarshsahay9908 Год назад
# nm = "Harry" # print(nm[-4:-2]) Output: ar len(nm)-4 and len(nm)-2 -----> [1,3] ------> prints ar(excluding the alphabet at index 3)
@LearnWith_IITianNikhil
@LearnWith_IITianNikhil Год назад
07:28 I'm using Python 3.11.0 and there was no output in that case print(fruit[-1:len(fruit)-3]) in VS Code
@currentl24200
@currentl24200 8 месяцев назад
Bcz [4 : 2 ] not valid.
@abhimanyukarkara4218
@abhimanyukarkara4218 9 месяцев назад
2:30 it is a confusing thing in python. For index slicing, we start with 0, which is till okay, but the last index is confusing. I was quite sure it should be [0:4] but we need to keep it [0:5] to get the 5th character, which is a hit annoying :/
@om6370
@om6370 10 месяцев назад
kamaal yr bhai negative slicing kya sikhaye tum, mazaa aagya
@missannie1272
@missannie1272 Год назад
i am watching a python's old playlist of harry bhai
@humayonjoiya2404
@humayonjoiya2404 Год назад
Alhamdulilah, 12 days done.
@saran67766
@saran67766 6 месяцев назад
Very nyc session and very interesting too🙏🙏
@pritammondal1164
@pritammondal1164 Месяц назад
Loving this course ❤ love you codie 😘😘😘😘😌i want to love my coding desire ❤
@sudhansubalasahoo
@sudhansubalasahoo Год назад
Present Sir I don't have instagram, so I will post the answer here: The output should be "ar" Because -4 means len(nm) - 4 which is 5 - 4 which starts from "a" and -2 means 5 - 2 which is 3 but it will not include third character(0, 1, 2, 3) and end with "r" So the output should be "ar".
@bhuvanch7797
@bhuvanch7797 Год назад
Are you from Odisha???
@sudhansubalasahoo
@sudhansubalasahoo Год назад
@@bhuvanch7797 Yes
@bhuvanch7797
@bhuvanch7797 Год назад
Hmm....Which district???
@sudhansubalasahoo
@sudhansubalasahoo Год назад
@@bhuvanch7797 In Bhubaneswar
@bhuvanch7797
@bhuvanch7797 Год назад
Ok
@souvikkumarsaha3776
@souvikkumarsaha3776 6 месяцев назад
nm=" harry " form (-4 to -2 means 5-4=1 to 5-2=3 ) that is 1 to 3. so it will print index 1 and 2. that means "ar"
@aqua.2.3m39
@aqua.2.3m39 6 месяцев назад
Nice bro
@anmolsrivastava2897
@anmolsrivastava2897 Год назад
how to calculate number of alphabets used (including repeating alphabets) in a statement? (excluding number of spaces, commas & full stops)→ len() will count ,/. as well as a character?
@omkarsawant9267
@omkarsawant9267 24 дня назад
Given the string nm = "Harry": Indexing: nm[0] = 'H' nm[1] = 'a' nm[2] = 'r' nm[3] = 'r' nm[4] = 'y' Negative indexing: -1 refers to the last character, which is 'y'. -2 refers to the second-last character, which is 'r'. -3 refers to the third-last character, which is 'r'. -4 refers to the fourth-last character, which is 'a'. Now, evaluating nm[-4: -2]: nm[-4: -2] translates to nm[1: 3] (since -4 corresponds to index 1 and -2 corresponds to index 3 when counting from the end of the string). Therefore, nm[-4: -2] extracts the substring starting from index 1 (inclusive) to index 3 (exclusive), which includes characters 'a' and 'r'. Output: The output of print(nm[-4: -2]) will indeed be "ar"
@Ajuu974
@Ajuu974 Год назад
Sir is their anything extra to learn for using python for Data alaysis 🤔😊 Or this course is enough 🙏
@DrRitul
@DrRitul Год назад
do dsa with python after learning this
@ulpnationll2953
@ulpnationll2953 Год назад
11:00 Output of the code = ar nm ="Harry" print(nm[-4:-2]) Output - ar Reason: print (nm[-4:-2]) = print (nm[nm(len)-4:nm(len)-2]) =print (nm[1:3]) Here it would print index assigned from 1 to 3 but not including index 3 . Will print till index 2
@sarthaksharma1858
@sarthaksharma1858 Год назад
Bro what about this one Please bro X = "Hello, World!" print(x[-5:-2])
@aliabbas632
@aliabbas632 Год назад
@@sarthaksharma1858 orl is the answer
@mughalfarii9425
@mughalfarii9425 Год назад
@@sarthaksharma1858 orl
@TabsAreHere
@TabsAreHere День назад
basically in range if you wanna print the whole thing start from 0 and end with how many letters does the word consist for eg , Harry number of words = 5 so 0:5, this gives the output Harry
@Gymboy805
@Gymboy805 Год назад
The Answer for the quick quiz is "ar". In positive slicing it will be similar to print(nm[1:3]).
@jyotirathore7691
@jyotirathore7691 Год назад
Algorithm are not given in data structure series also plz make videos on how to write algorithm of data structure i really appreciate yr work 👍
@designview4723
@designview4723 Год назад
Video #12 Done ...... Subject = "pyythhonnn" print (len(Subject)) print (Subject [0:4]) print (Subject [0:9]) print (Subject [ :5]) print (Subject [0:-3]) Name = ("Harry") print (Name[-4:-2]) Name = "Wellcomepython" print ( Name[-14:-6]) Output 10 pyyt pyythhonn pyyth Pyythho ar Wellcome
@Tricks662
@Tricks662 Месяц назад
Sir Answer is ar because H a r r y = o 1 2 3 4 length is = 5 So 5-4 = 1 = a and 5-2 = 3 = r
@palak004
@palak004 10 месяцев назад
Learning:- 1.len is used to count no. of characters in a string, 2. name = Palak print(name[0:4]) it means it will you'll get index from 0 to 3. output: Pal if [ :4 ] is only written it'll automatically consider it as [0 ] if it is skip 3. Negative slicing print(name[0 : -3 ] output : Pa , writting this python automaticlly adds print(name[0 :len(name) -3 ] or print(name[ :len(name) -3 ] output : will be same print(name[ -1 : -3]) python interpretre : 5-1 : 5-3 = 4:2 makes no sense if print(name[ -3 : -1]) output : la python interpretre : 5-3:5-1 = 2:4
@EntertainmentHUB099
@EntertainmentHUB099 Год назад
Thanks a lot guys for your love and support Guys love you all 🥺🥺❤️
@dioptre
@dioptre Год назад
who tf is supporting you?
@navejpathan
@navejpathan Год назад
Day 12 Done!!! Answer is ar. Explanation - nm='Harry' nm[Len(nm)-4:Len(nm)-2] i.e nm[1:3] Therefore ar.
@CodeDaily365Days
@CodeDaily365Days Год назад
answer will 4-4 and 4-2 which is [0:2] then the output will be "ha' length of the nm = 4 because index start from 0... hope this will help you :}
@navejpathan
@navejpathan Год назад
@@CodeDaily365Days no brother Length of nm =5 As I explained. Please try to run so u can get better understanding.
@diwakarsingh6390
@diwakarsingh6390 Год назад
@@navejpathan It will print ar bcz,indexing of array starts from 0 not from 1
@navejpathan
@navejpathan Год назад
@@diwakarsingh6390 exactly brother my answer is also ar. You can refer my explanation in previous comments.
@erensindhu6496
@erensindhu6496 Год назад
@@CodeDaily365Days its 'ar' as index starts from zero but length starts from 1. So here, index is h(0)a(1)r(2)r(3)y(4). [-4:-2]=[5-4:5-2]=[1:3] and now it will print according to the index which is a(1) and r(2) as 3 is not included. So, output will be 'ar'.
@podcastshorts508
@podcastshorts508 4 месяца назад
output is ar sir thnku for this amazing course
@mrfrost2151
@mrfrost2151 5 месяцев назад
harry sir the answer to the quick quiz is "ar" because (-4 : -2 ) will be equal to ( 1: 3) that is 'ar' in harry
@neejanand771
@neejanand771 Год назад
Ar because first we minus 4 from 5 than 1 from 5 now we have 1:3 Then We started counting from Zero then we have Answer "ar" from "Harry" Bhaiya please like to make memorable for me
@Mycode-zb6iq
@Mycode-zb6iq Год назад
Question for experienced python developer - How are you guys approaching this course if you are following this from Day1
@aalokkarn5940
@aalokkarn5940 Год назад
Experienced python developer arenot following this from day 1 bro
@owaisnadeem2751
@owaisnadeem2751 10 месяцев назад
Day 12 Present Sir Love and respect from Pakistan
@user-ig9jj4rn9z
@user-ig9jj4rn9z Год назад
Thanks a lot for teaching python for free
@arshmalik7918
@arshmalik7918 Год назад
Revision 1- What Is String Slicing We can Find The Length Of String Using len() function , for example Ans = "My Name Is Arsh" print (len(Ans)) , then output is 12 Second example, Student = "Arsh" lenArsh = len(Student) print ("The letters in the word "\Arsh"\ is , " lenArsh) Python Count Numbers From zero , for example Name1 = "Arsh" Print (name1[1]) , output is A Friends = "Arsh , Rohan" If I want to print only my name I can use this, Print (Friends[0:5]) , output is Arsh Print (Friends[1:5]) ,then output is rsh Print (Friends[:5]) ,then automatically output is Arsh Negative Slicing a = "Hello" Print ( a [0 : -3] ) Length of a is 5, 5 - 3 = 2 Python automatically insert len function like Print ( a [0 :len(a) -3] ) Than output is , He # Quick quiz: nm = "Harry" Print (nm[-4 : -2]) Explain: Print (len(nm)) , output is 5 5 - 4 = 1 5 - 2 = 3 [1:3] Output is ar
@Harshaaaaaaa
@Harshaaaaaaa Год назад
The output will be "r" in (python counts from zero) just a small correction :)
@varshithareddy7372
@varshithareddy7372 Год назад
@@Harshaaaaaaa the output is 'ar' not 'r' once check it out
@raghavthakurrt6539
@raghavthakurrt6539 Год назад
@@Harshaaaaaaa output will be ar
@Harshaaaaaaa
@Harshaaaaaaa Год назад
@@varshithareddy7372 Ik it's "ar" I'm talking about his comment.. i guess he edited it. Read his comment & lemme know
@Harshaaaaaaa
@Harshaaaaaaa Год назад
@@raghavthakurrt6539 Ikr
@CodeWithHarry
@CodeWithHarry Год назад
Code Backup Repository: github.com/CodeWithHarry/100-days-of-code-youtube
@prabhatpandey4014
@prabhatpandey4014 Год назад
ar
@publicentertainmentgaming6210
Har
@amiralam1000
@amiralam1000 10 месяцев назад
ar
@freeman8246
@freeman8246 10 месяцев назад
bro its only ar @@publicentertainmentgaming6210
@CricketLive18K
@CricketLive18K 8 месяцев назад
Ha
@user-re9lg1bp3o
@user-re9lg1bp3o 10 месяцев назад
answer is "ar" , len(nm) - 4 = 1 , and len(nm)-2 = 3 now slicing is from [1,3] , i.e. a and r having indexing 1 and 2 and we sliced only till n-1 numbers.
@sanju5392
@sanju5392 11 месяцев назад
answer = ar , since nm has 5 characters so therefore, 5-4=1 and 5-2=3 , so now it should be print(nm[1:3]) so we get output as ar which includes 1st position but not 3rd position.
@sanemi9816
@sanemi9816 4 месяца назад
Hello sir can we do coding using Visual Studio Code? Also please suggest which is better, replit or vs code
@abhijeetprasad2761
@abhijeetprasad2761 Год назад
It will print ar because length of the string is 5 so 5-4 is 1 and 5-2 is 3 so 1:3 where it will print from index 1 to n-1 (3-1) so it will print index 1 and 2 .therefore the answer will be ar.
@MovieOk-p8q
@MovieOk-p8q 7 месяцев назад
Review: 🌟🌟🌟🌟🌟5 stars. Guys I have reaches day 35 and this is very Amazing and easily understandable course. By harry bhaiya. 😊😊😊😊😊😊😊😊😊😊 You can also watch without wasting time. ❤❤❤❤❤❤ Inke video se define function, and recursion jaise topics easily sm aa jate hai. 🎉🎉🎉🎉🎉🎉🎉 Thanku harry bhaiya 😁😁😁😁. Abi muje college me 3 months hi hue hai and I am expert in my class. I have already learn basics of python and now I am at advance. Bhaiya ap data science se related aur subjects pe video bnayenge to hme bhut acha lgega. Jaise DSA IN PYTHON, statistics, r, sas, powerbi, tableau and baki jo bi semesters subject hote hai for data science. Thanku bahiya🎉🎉🎉🎉🎉🎉❤❤❤😀😃😃😁😁😃😁😃😀😀😁😀😊😀😁😃😁🙃😊🙂😊🙂😉🙂😆😀😁😁🙂😁🙂🤩🤩🙂🤩🤩🤩🤩🤩🤩🙂🤩🤭🙃🤭🙃🤭🙃🤭
@rosh_sings
@rosh_sings 2 месяца назад
in this video, towards the end, i could see an 'applepie' example. for [5: ], its showing pie as output. how is that? coz i am not getting it.
@mukeshkumar3306
@mukeshkumar3306 7 месяцев назад
nm = "Harry" print(nm[-4:-2]) this a statement. Print ar hoga because python mein indexing 0 se start hoti right but last of index position per ek pahle wali count hogi it's means last wali index ko mention nahi karna hai
@rishirajvlogs3131
@rishirajvlogs3131 3 месяца назад
bahut acha content banate ho bhaii bahut sikha h tumhari videos se lekin yaar ak cheej batauu jo mereko personally achi nahi lagi wo h ki tum bolte bahut ho yaar mtlb har video me starting me itna josh nahi chahiye hum sikh rhe h kisi karan se hi to sikh rhe honge na bhaii by the way tumhara content kya hi lagta h bhaii ak no. wo bhi hindi me itna acha content bhaii thank you for these all beautifully made courses for us. These are the one of the finest courses which we are getting in free thank you so much for this. brother
@nazishzafar2539
@nazishzafar2539 11 месяцев назад
you really taught amazing ☺
@GAMING_IN_DARKSIDE
@GAMING_IN_DARKSIDE 9 месяцев назад
in my case i use (nm=hacker) 6 char of my str rekc- minus from hacker= remain =hac phly last char se negtive minus krega fr starting se negative minus kre ga that its start index =h0 a1 c2 to index 0 -2 it print from 2 index k char index 2 per k char hai jo print ho jae ga (am i right)or not final print = ck
@Let-s_Entertain....
@Let-s_Entertain.... Год назад
Thanks for Everything Sir
@_Parth.hh_
@_Parth.hh_ 10 месяцев назад
does this course cover DSA(Data Structure and Algorithm) ?
@MuhammadIhsan-gu6ks
@MuhammadIhsan-gu6ks 6 месяцев назад
name = "Harry" print(name[-4 : -2]) in this case the answer is ar because the length of the harry is 5 and 5-4 = 1 and 5-2 = 3 the python compiler slice the value in name[1 : 3]
@RoshanNayak-lc5rl
@RoshanNayak-lc5rl 6 месяцев назад
#Day_2 of this amazing course ❤❤
@beast-6
@beast-6 7 месяцев назад
at 10:24 in quiz answer is len(nm)-4:len(nm)-2 5-4:5-2 1:3 then it print nm[1]=a and nm[2]=r O/P:ar
@NishantKumar_N
@NishantKumar_N Месяц назад
10:22 nm = "Harry" #length of Harry is 5. print(nm[-4 : -2]) #output --> ar, because 5 - 4 = 1, 5 - 2 = 3 and 3 include nahi hoga, isliye 1 se 2 tak print karega
@rpgamers369
@rpgamers369 Месяц назад
#so there are 5 char in harry 5-4=1 and 5-2=3 so 1:3 index start from 0 so h=0 a=1 r=2 r=3 y=4 so as we know it dont include last but include last-1 so ar is output
@RehanPathan-3221
@RehanPathan-3221 Год назад
# quick quiz nm = "harry" print(nm[-4:-2]) the answer is the ar
@lmslectures8836
@lmslectures8836 7 месяцев назад
hello which book have you used to teach python please let me know
@palexplains
@palexplains 4 месяца назад
For the quick quiz as lenght of Harry is 5 and [-4:-2] which will be [1:3] and it will print ar
Далее
String Methods in Python | Python Tutorial - Day #13
22:32
IQ Level: 10000
00:10
Просмотров 2,9 млн
Python string slicing ✂️
11:37
Просмотров 59 тыс.
Strings in Python | Python Tutorial - Day #11
11:35
Просмотров 836 тыс.
For Loops in Python | Python Tutorial - Day #17
13:01
Просмотров 695 тыс.