DEV Community

Arokya Naresh
Arokya Naresh

Posted on

Python tutorial 11.07.2024

  1. 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

  1. Text Type (strings)
    strings-collection of charcters,numbers,space
    using quotation we can represent a string

  2. Boolean Type (bool)
    True
    False
    if loop is active or not

  3. None Type (None)
    None-we cannot create a empty variable

  4. How to check a data type ?
    By using type()

  5. What is a variable ?
    container of data value

  6. How to define it

  7. valid, invalid variables
    can start or join with underscore _
    no special characters

  8. assigning values
    eg:var=123
    AB 13

  9. multiple assignment
    eg: name,age='AB',13 -->tuple datatype
    print(name,age)
    o/p:AB 13

  10. unpacking
    eg:emp_name,emp_id=AB,1001,152
    print(emp_name,emp_id)
    o/p: ValueError: too many values to unpack

  11. variable types
    from above eg1:print(type(emp_name))
    o/p:class str
    eg1:print(type(emp_id))
    o/p:class int

  12. Constants
    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

is used for comments

Top comments (0)