Python tutorial 11.07.2024
- Numeric Types (int, float, complex) whole number-integers decimal number-float real+imaginary number-complex(space is not mandatory)eg:5+2j or 5 + 2j both are same
to check what datatype we can use type()
eg:type(1)
o/p int
Text Type (strings)
strings-collection of charcters,numbers,space
using quotation we can represent a stringBoolean Type (bool)
True
False
if loop is active or notNone Type (None)
None-we cannot create a empty variableHow to check a data type ?
By using type()What is a variable ?
container of data valueHow to define it
valid, invalid variables
can start or join with underscore _
no special charactersassigning values
eg:var=123
AB 13multiple assignment
eg: name,age='AB',13 -->tuple datatype
print(name,age)
o/p:AB 13unpacking
eg:emp_name,emp_id=AB,1001,152
print(emp_name,emp_id)
o/p: ValueError: too many values to unpackvariable types
from above eg1:print(type(emp_name))
o/p:class str
eg1:print(type(emp_id))
o/p:class intConstants
defining a value that remains same throughout the end of the progam.
eg:PI=3.14 this is a constant value
constant value defined by CAPITAL LETTER
NOTE:
Python is case sensitive
dynamic datatype will allocate different memory