String indexing in Python is easy ✂️
ฝัง
- เผยแพร่เมื่อ 23 ก.ค. 2024
- #python #tutorial #course
00:00:00 string indexing
00:05:17 last 4 digits exercise
00:06:27 reverse a string exercise
00:07:06 conclusion
indexing = accessing elements of a sequence using [] (indexing operator)
[start : end : step]
credit_number = "1234-5678-9012-3456"
print(credit_number[0])
print(credit_number[0:4])
print(credit_number[:4])
print(credit_number[4:8])
print(credit_number[4:])
print(credit_number[-1])
print(credit_number[-4:])
print(credit_number[::2])
print(credit_number[::3])
EXERCISE 1
credit_number = "1234-5678-9012-3456"
last_digits = credit_number[-4:]
print(f"XXXX-XXXX-XXXX-{last_digits}")
EXERCISE 2
credit_number = "1234-5678-9012-3456"
credit_number = credit_number[::-1]
print(credit_number)
# indexing = accessing elements of a sequence using [] (indexing operator)
# [start : end : step]
credit_number = "1234-5678-9012-3456"
print(credit_number[0])
print(credit_number[0:4])
print(credit_number[:4])
print(credit_number[4:8])
print(credit_number[4:])
print(credit_number[-1])
print(credit_number[-4:])
print(credit_number[::2])
print(credit_number[::3])
# EXERCISE 1
credit_number = "1234-5678-9012-3456"
# last_digits = credit_number[-4:]
# print(f"XXXX-XXXX-XXXX-{last_digits}")
# EXERCISE 2
credit_number = "1234-5678-9012-3456"
credit_number = credit_number[::-1]
print(credit_number)
Do you include these shortvids to their main courses?
Wanted to thank you Bro code,thanks to your lessons I learned Java and now I'm way ahead of my course in school and that made my life so easier,also im looking forward to learning other programming languages with your teaching
Well, that's quick! Keep up the good works!
Less time , Very quality teaching. Your name defines you Bro Code!!
Is that thumbnail your way of saying that you are locked in a basement forced to make coding tutorials?
HURRY!
Great Content!
great lesson :D
I love your videos so much! You have helped me a lot! I am currently struggling with importing and using other python files to the main python file... Could you please do a video about writing and reading from other python files?
Thanks
you are a true legend.
bro this video came out just i was doing string indexing with array for my game
THNX
Awesome video Bro, hope you get to 1 mil soon
Thanks you so much bro☆
Bro your Python Vids were just a gold mine for me and many of my friends. Less time quality teaching thanks for it bro
one request :- Can you start JS or React Js course and also some python projects??
Hey @BroCode,
Love your channel.
I really liked your previous logo for the channel, and also the introductory + concluding short funny monologues, like in javaFX videos.
Please bring that vibe back❤
Late to this party. Currently heading through Intro to Scripting. Found your channel and love it. Thank you! Sub’d.
WOW! can't imagine how good are u at python!
thanks bro
Thank you
thank u bro, i love u
very easy to understand ..thanks @Bro Code
great straight forward video. please do one on regex.
Is there any full course of python that you have prepared. I would like to learn from you. I’m new to programming and struggling to get the logic.
Absolutely chad
yo bro can u make a lua tutorial pls? also nice video
Hello bro
Can you make a video on argument counts and argument vectors in C programming language
Sir, can u explain recursion in python?
What do you use to code
Hey , Ik this is unrelated but can u pls make a course on react js? Thanks gigaChad😅
Can you make a renewed" How to make Snake Game"
Bro your the true CHAD
Drop the full SQL course king 👑
Sir how did you learn all these technologies? What are learning strategies couldnu share ? You are an inspiration ,love from India♥️
I went to university
@@BroCodez great University,in our university they never go depth
Please Bro can u explain for me why u write (f) like string
(f "xxxx xxxx xxxx {last_digits}")./
Thank u
Are you Westjett by any chance
First!! pls heart!
ok
Yo I'm 2nd Mr. bro
How did you learn to code?
I went to university
Here's some code I wrote with string indexing:
import math
firstName = input(f"What is your first name?: ")
print(f"The first letter of your first name is {firstName.upper()[0]}.")
print(f"The last letter of your first name is {firstName.upper()[-1]}.")
print(f"Your first name written backwards is {firstName[::-1]}.")
middleName = input(f"What is your middle name?: ")
print(f"The first letter of your middle name is {middleName.upper()[0]}.")
print(f"The last letter of your middle name is {middleName.upper()[-1]}.")
print(f"Your middle name written backwards is {middleName[::-1]}.")
lastName = input(f"What is your last name?: ")
print(f"The first letter of your last name is {middleName.upper()[0]}.")
print(f"The last letter of your last name is {middleName.upper()[-1]}.")
print(f"Your last name written backwards is {middleName[::-1]}.")
print(f"Your initials are {firstName[0]}{middleName[0]}{lastName[0]}.")
i promise end seing later
algo
why dose it say help me
But isn't this also called slicing?
bro just say python is easy
String indexing Dumbest and most boring Python Subject...