Skip to content

Instantly share code, notes, and snippets.

@Yougigun
Last active July 11, 2020 00:56
Show Gist options
  • Save Yougigun/3ad20425d5d599496773cd293fa90cc6 to your computer and use it in GitHub Desktop.
Save Yougigun/3ad20425d5d599496773cd293fa90cc6 to your computer and use it in GitHub Desktop.
create dictionary
# Create Dictionary
## 1. dict(key=value,...)
family_age_a = dict(Dad=55, Mom=54, Bro=23)
## 2. {key:value,...}
family_age_b = {'Dad': 55, 'Mom': 54, 'Bro': 23}
## 3. dict([(key,value),...])
family_age_c= dict([('Dad', 55), ('Mom', 54), ('Bro', 23)])
## 4. dict({key:value,...})
family_age_d = dict({'Dad': 55, 'Mom': 54, 'Bro': 23})
family_age_a == family_age_b == family_age_c == family_age_d
#output :Ture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment