#10 Python Tutorial for Beginners | Data Types in Python

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

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture we are discussing about DataTypes in Python:
-- why it is important?
-- how to use it ?

Python has several built-in data types. Here are some of the most common ones:

i) NoneType: This is a special data type that represents the absence of a value. It is similar to null in other languages.
ii) Numbers: These can be integers, floating-point numbers, or complex numbers.
iii) Booleans: These are values that represent True or False.
iv) Lists: These are ordered collections of objects, enclosed in square brackets.
v) Tuples: These are similar to lists, but are immutable (i.e., their contents cannot be changed), and are enclosed in parentheses.
vi) Sets: These are unordered collections of unique elements, enclosed in curly braces.
vii) Strings: These are sequences of characters, enclosed in single or double quotes.
viii) Ranges: These are immutable sequences of numbers, and are commonly used to iterate over a sequence of numbers in a for loop.
ix) Dictionaries: These are collections of key-value pairs, enclosed in curly braces.


i)None Type
a=None
type(a)

ii)Numbers
int: if you want to assign a integer value to a variable
a=5
type(a)

float: if you want to assign a float value to a variable
num =2.5
type(num)

complex: if you want to assign a complex value to a variable
num =2+9j
type(num)

# type conversion: if you want to convert one data type to another data type
a=5.6
b=int(a)
type(b) # output : int
k=float(b)
type(k) # output : float
c=complex(4,5)
type(c) # output : complex

iii)boolean: if you want to assign a variable with a boolean value
a= True
type(a) # output : bool
bool=3 less then5
True
type(bool)


Sequence data types : if you want to assign a variable with multiple values
List, Tuple, Set, String, Range.

iv) List if you want to assign a variable with multiple values and you want to change the values
-- In Python, a list is a collection of ordered and mutable elements enclosed
in square brackets. Lists are one of the most commonly used data structures in
Python because of their versatility and flexibility.

lst=[25,36,45,12]
type(lst) # output : list

v) Tuple: if you want to assign a variable with multiple values and you donot want to change the values make immutable
-- In Python, a tuple is a collection of ordered and immutable elements enclosed in parentheses.
Tuples are similar to lists, but they cannot be modified once they are created, which makes them
useful for storing data that should not be changed during the program's execution.

t=(25,36,45,12,7)
type(t) # output : tuple

vi) Set: if you want to assign a variable with multiple values and you donot want to change the values and you donot want to duplicate values
-- In Python, a set is an unordered collection of unique elements enclosed in curly braces.
Sets are useful for storing data that should not contain duplicates, such as a list of
users on a website.

s={25,36,45,12,25,36}
type(s) # output : set
#output: {36, 12, 45, 25}

vii) String: if you want to assign sequence of characters to a variable
-- In Python, a string is a sequence of characters enclosed in single or double quotes.
Strings are immutable, which means that they cannot be modified once they are created.

str = "hello"
type(str) # output : str

we are not talk about char data type in python
st='a' # every character is a string in python

viii) Range: if you want to assign a variable with multiple values and you don't want to change the values and you want to generate a sequence of numbers
-- In Python, a range is a sequence of numbers that is immutable and iterable.
Ranges are commonly used to iterate over a sequence of numbers in a for loop.

range(10) # range data type
type(range(10)) # output : range
list(range(2,10,2)) # output : [2, 4, 6, 8]

ix) Dictionary: if you want to assign a variable with multiple values and you donot want to change the values and you want to assign a key to each value
-- In Python, a dictionary is a collection of key-value pairs enclosed in curly braces.
Dictionaries are useful for storing data that is associated with a key, such as a list of
users on a website and their corresponding email addresses.

d={1:'a',2:'b',3:'c'}
type(d)

d1={'navin':'samsung','rahul':'iphone','kiran':'oneplus'}
d['rahul'] #output : 'iphone'
Рекомендации по теме
Комментарии
Автор

I'm searching for the one who can teach me good but found the best, u r really amazing sir, I have suscribed ur channel and also suggested my friends those who are dying to learn python like me...tq so much sir 🙏

satyavanikalisetti
Автор

A fantastic jobb done by a knowledgeable person. I wish you were my tutor in college.
Your efforts are much appreciated. Thank you

roopa
Автор

🤓 Quiz Answer 🤓
How to access the help docs in python?
Answer : " help( ) " using this command we can access the docs in python.
" help ( "LISTS" ) We can also use this command to search for specific topic in help doc.

milanbariya
Автор

Hi Navin, could you please also provide exercise sheets so that we can get good practice on each topic as soon as a video is finished.

Maheshwari_Ravi
Автор

You explained everything in a practical and fun way. Thank you for your videos.

nilusah
Автор

You are one of the most most best Language-Youtuber among other Language-Youtubers who doesn't confused to their viewers ...👍👍👍

MOHNAKHAN
Автор

Hi Navin, Thanks for your great tutorials . In this video having a minor correction at 8:46 . Other modern programming languages ( like "Swift Programming Language" ) also supports "Range". In Swift, having dedicated range operators ( "...", "..<") to perform range operations. Thanks :)

kamaleshwaranselvaraj
Автор

sir you are like Guru Dronacharya to me these videos are so helping me to gain my pragmatic knowledge in python. sir i was totally zero in coding but now due to your teaching im building my interest in coding thank you so much for this and please keep inspiring and educating us as u do of support and love :)
And sir please upload some exercise sheets after your videos so that we can practice

VirendraPawar
Автор

I am actually referring a lot of resources right now as I am going into the IT industry through data science, AI and ML, and to be totally honest, I have found some tips and tricks that I did not get in other tutorials. Kudos for that, keep up the good work. Thanks for such an amazing and selfless content. I would still like to ask you if you have any other resources that would help me in my journey ahead, do let me know in the reply.

pviyengar
Автор

Great teacher in this era still watching in 2024😊

kalabanki
Автор

Hello Sir, I love to watch this series. I have always watch your video whenever I was stuck or learn a new thing about software development. You made a great video for student who wants to learn from basics and reach to advances.

robincr
Автор

You are really a best teacher. Even school kids can learn python when you teach. Im very happy that i found you

nishajenifer
Автор

This is an incredibly fast way to learn this. Thank you.

kestergascoyne
Автор

12:22-12:31
"you have to use curly brackets
now why curly brackets because keys should not repeat
and what doesn't repeat
set
and set uses curly brackets
so it makes more sense here"
what an amazing explanation :)

ShivamPanchbhai
Автор

Excellent teaching! I HAVE JUST WATCH 10 VIDEOS OF NAVIN SIR AND I AM FULLY UNDERSTAND HOW TO DO CODING.EXCELLENT TEACHING SIR! U WILL LIVE 1000 YEARS.

alltechsystem
Автор

Your way of teaching is excellent sir..before watching your classes, i am afraid of doing coding but now i have got a lot of confidence that's all because of sir...Thank you for sharing your knowledge to us....

sravyagorapalli
Автор

Thanks for your vedios I wanted to learn python for machine learning and these basics helped me to grade up faster

shashankbharadwaj
Автор

U are really fantastic sir, just provide notes or exercise so we can practice all if u can
Thanks for such a dedication to ur youtube channel.and helping us grow.

dishantkumbhar
Автор

I am learning python first time and your tutorials are really helpful. Hope to follow this playlist till end.

MinhajAhmedAnsari
Автор

I am practicing the lessons you are teaching in my computer. My computer has python 3.7 so I am able to practice whatever you are explaining. And these are very helpful to me. Thanks a lot for the lessons you are teaching to me.

RavikanthTalakoti