#4 Python Tutorial for Beginners | Variables in Python

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture we are discussing variable in python:
Variable: It is a container where we can put our value
e.g
x=2 #here x is variable and 2 is value
x+3
5
y=3

Note:If I want to use output of previous operation so we use underscore (_)
_+y
8 # previous output 5 and y is 3

Use String as a variable:
-- Strings in python are surrounded by either single quotation marks, or double quotation marks.
-- e.g "shiva" ,'shiva'

Assign String to a Variable:
-- Assigning a string to a variable is done with the variable name followed by an equal sign and the string:
name='shiva'
name
shiva

Slicing String:
we can return a range of characters by using the slice syntax.
Specify the start index and the end index, separated by a colon, to return a part of the string.

-- Get the characters from position 2 to position 5 (not included):
name='youtube'
name[2:5]
'utu'

Slice From the Start:
name[:5] #from starting to index 5 (exclude)
'youtu'

Slice To the End:
name[2:] #from 2nd index to end
'utube'

Negative Indexing:

0 1 2 3 4 5 6 #positive indexing
y o u t u b e
-7 -6 -5 -4 -3 -2 -1 #Negative indexing

name[-1]
'e'

name[:-1]
'youtub'
name[:]
'youtube'
name [:0]
''
name[-5:-2]
'utu'

Concatenate String:
name+ ' telusko'
'youtube telusko'

More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

Navin Reddy has 11 characters (including space between two words)

Telusko
Автор

Making such a effort without expecting anything and explaining with lots of clarity is really awesome, and huge respect to you

motheakanksha
Автор

1. print(r '\n') means print as it is.
2. _ (underscore represents) result of last.
3. name[-1] last digit of array
4. name[-2] last but digit of array
5. name[0:2] if name = ajit it will print 'aj'
6. name[0:3] if name = ajit it will print 'aji'
7. len(name) it will print 4(length of the ajit)
8. if a = ajit a[1:3] - when you print this it will give "ji" not "jit" because indexing excludes the last letter.

ajitsakri
Автор

I have been studying python for about 3-4 months now. Your enthusiasm is contagious. I had so much fun learning this😁

nezzylearns
Автор

Output -
Telusko \n Rocks
Since at start of the string you've mentioned r which stands for raw string, it means that the string will be printed as it is(in a raw state) no special meanings will be considered.

chughprabhkirat
Автор

Wanted to learn Python from last 2 years but unable to continue interest and now you're here 😍
Loving the sessions

sagarthoke
Автор

most energetic teacher on YouTube.. tbh one of the best teachers I have ever seen in my life.

predatorishi
Автор

First time ever in my life listening carefully with full interest on one pgming language lecture...the same lecture on these topics by my faculty made me sleep so hard😝...great effort and concept is easily understandable...Thanks a lot sir.

roshnikrishna
Автор

Just started this because I was frustated with Java courses. This is much simpler! thank you sir!!

HarrisTheHypnotist
Автор

You're a GOD'S GIFT to us!! ♥️ Couldn't imagine to learn something with such fun, thank you Navin 💯

kartikjswl
Автор

Never knew python is enjoyable this way. Thanks for it.

aishwaryasrikanth
Автор

Print (100*respect)
Love the way you tech nivin sir..
Learning during corona holiday 😁

sagarsonar
Автор

much better than code with harry playlists . He is atleast starting this from start not like harry u have started his series from quiet a high level

atharvasachan
Автор

Thanks Navin for your wonderful series. Your way of explaining thse concepts is exemplary. Easy and to-the-point.
I used to teach C lanuage 20 years ago, and I like the way you are doing this very much.
Thanks for taking the time to simplify this. Bless you

Amr-Ibrahim-AI
Автор

I never thought python so easy programming language by listening this awesome lecture...
Thank you so much Navin Reddy Sir...

shreyashshinde
Автор

Your explanations are very easy to understand and anyone who is struggling to learn programming before can learn easily just by watching your sessions

studymaterial
Автор

Output for quiz question:
Telusko \n Rocks
Thank you sir for clear explanation, , after executing codes you are saying wow its working☺, that's good sir. You are changing the way of learning, keep going on navin sir. I am suggesting all my friend's to watch your channel

mannemsrikanth
Автор

name='navin reddy'
respect='nosire'
print('thank you ' +name+' '+respect[2:5])

abhilashdevarakonda
Автор

Love python from a such a talented and interactive teacher sir

ankurgupta
Автор

previously i was not in the mood to learn python, but your videos made me do so

MuzicBae