Ticker

6/recent/ticker-posts

Python Data Types | Let's Update

 Data Types

Python Data Types | Let's Update

Data type is the important concept in all programming languages, the person who aimed to learn a particular programming language then the person should learn data types.

Python has the following data types built-in by default, in these categories:

   Text Type               str
  Numeric Types   int, float, complex
  Sequence Type   list, tuple, range
  Mapping Type   dict
  Set Types   set, frozen set
  Boolean Types   bool
  Binary Type   bytes, bytearray, memoryview


Getting Data Type:

You can find a data type of your variable by using type() function:

Example Program:
 
    a=10
    b="Let's Update"
    print(type(a))
    print(type(b))
      
                                                              Output:   <class 'int'>
                                        <class 'str'>

Declare a data type.
In python We Don't Need To Declare A data type, 
when we assign a value it will set by default.

ExampleData Type
x = "Hello World"str
x = 20int
x = 20.5float
x = 1jcomplex
x = ["apple", "banana", "cherry"]list
x = ("apple", "banana", "cherry")tuple
x = range(6)range
x = {"name" : "John", "age" : 36}dict
x = {"apple", "banana", "cherry"}set
x = frozenset({"apple", "banana", "cherry"})frozenset
x = Truebool
x = b"Hello"bytes
x = bytearray(5)bytearray
x = memoryview(bytes(5))memoryview

Post a Comment

1 Comments

  1. How to Make Money from Betting on Sports Betting - Work
    (don't worry if ventureberg.com/ you get it wrong, though) The process involves placing https://sol.edu.kg/ bets on different 토토사이트 events, but หาเงินออนไลน์ it novcasino can also be done by using the

    ReplyDelete