Playback starts YouTube’s embedded player (privacy-enhanced mode).
#4 Python Tutorial for Beginners | Variables in Python
ChannelTeluskoIn brief
This tutorial shows how to use variables in Python to store values, work with strings, and perform basic string operations like slicing, indexing, and concatenation. It’s perfect for absolute beginners looking to grasp Python’s foundational concepts.
Key steps
- Create a string variable with single or double quotes (e.g., name = 'shiva').
- Slice a string by specifying start and end indices (e.g., name[2:5]).
- Access characters using negative indexing (e.g., name[-1]).
- Concatenate strings with the + operator (e.g., name + ' telusko').
Questions & answers
How do I extract a substring from the start or end?
Use name[:5] for the start or name[-3:] for the end (excludes the end index).
Description from the creator
Check out our courses:
Agentic AI with Java : Live Cohort : go.telusko.com/agentic-ai-with-java-cohort
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : telusko.com/
Udemy Courses:
Java Spring:- go.telusko.com/Udemyjavaspring
Java:- go.telusko.com/udemyteluskojava
Spring: go.telusko.com/udemyteluskospring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopython
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodocker
Instagram : instagram.com/navinreddyofficial/
Linkedin : in.linkedin.com/in/navinreddy20
WhatsApp : go.telusko.com/whatsapp
Discord : discord.gg/D8hWe9BqfF
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'
Github :- github.com/navinreddy20/Python-
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
telusko.com
Agentic AI with Java : Live Cohort : go.telusko.com/agentic-ai-with-java-cohort
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : telusko.com/
Udemy Courses:
Java Spring:- go.telusko.com/Udemyjavaspring
Java:- go.telusko.com/udemyteluskojava
Spring: go.telusko.com/udemyteluskospring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopython
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodocker
Instagram : instagram.com/navinreddyofficial/
Linkedin : in.linkedin.com/in/navinreddy20
WhatsApp : go.telusko.com/whatsapp
Discord : discord.gg/D8hWe9BqfF
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'
Github :- github.com/navinreddy20/Python-
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
telusko.com
About this tutorial
Telusko published this 10:22 video tutorial on October 28, 2018. It has been watched 3,769,245 times on YouTube.
- Channel
- Telusko
- Category
- Science & Technology
- Duration
- 10:22
- Published
- October 28, 2018
- Views
- 3,769,245
- Likes
- 64,921
Tags
Share
This tutorial in other languages
- FR# 4 Python Tutorial pour les débutants | Variables en Python
- ES# 4 Tutorial de Python para principiantes | Las variables en Python
- PT# 4 Python Tutorial para Iniciantes | Variáveis em Python
- IT# 4 Python Tutorial per principianti | Le variabili in Python
- DE# 4 Python Tutorial für Anfänger | Variablen in Python
- NL# 4 Python Tutorial voor beginners | Variabelen in Python
- RU# 4 Учебник Python для начинающих | Переменные в Python
- PL# 4 Python Tutorial dla początkujących | Zmienne w Pythonie
- JA初心者のための#4のPythonチュートリアル| Pythonでの変数
- AR# 4 بيثون دروس للمبتدئين | المتغيرات في بيثون
- HI# शुरुआती 4 अजगर ट्यूटोरियल | अजगर में चर
- ID# 4 Python Tutorial untuk Pemula | Variabel dalam Python