Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

dict Data Type:

Vinay Rawal answered on April 1, 2023 Popularity 7/10 Helpfulness 1/10

Contents


More Related Answers

  • how to type a dict in python
  • enctype
  • how to find the data type in python
  • python data types
  • python datatypes
  • variables and data types in python
  • python data types
  • python data types
  • variables and data types in python
  • value types in Python dictionary
  • ctypes dictionary
  • how to get the data type in python
  • Keys, Values & Data Types
  • Python’s Data Types#
  • python dict type
  • pythpn data tyoe

  • dict Data Type:

    0

    If we want to represent a group of values as key-value pairs then we should go for dict data type.

    ֍ Eg: d = {101:'durga',102:'ravi',103:'shiva'}

    ֍ Duplicate keys are not allowed but values can be duplicated. If we are trying to insert an entry with duplicate key then old value will be replaced with new value.

    Eg: 1) >>> d={101:'durga',102:'ravi',103:'shiva'} 2) >>> d[101]='sunny' 3) >>> d 4) {101: 'sunny', 102: 'ravi', 103: 'shiva'} 5) 6) We can create empty dictionary as follows 7) d={ } 8) We can add key-value pairs as follows 9) d['a']='apple' 10) d['b']='banana' 11) print(d) Note: dict is mutable and the order won’t be preserved.

    Note:

    1) In general we can use bytes and bytearray data types to represent binary information like images, video files etc 2) In Python2 long data type is available. But in Python3 it is not available and we can represent long values also by using int type only. 3) In Python there is no char data type. Hence we can represent char values also by using str type.


    Popularity 7/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Apr 01 2023
    Vinay Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.