Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

dictionary output.pptx

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
variable assignment.pptx
variable assignment.pptx
Wird geladen in …3
×

Hier ansehen

1 von 1 Anzeige

Weitere Verwandte Inhalte

Aktuellste (20)

Anzeige

dictionary output.pptx

  1. 1. Output: Create a Dictionary and perform the following methods 1) Print Dictionary Items 2) Access Items 3) Use get() 4) Change Values 5) use len() ────────────────────────────── Enter the State and its Capitals for 3 states Enter State: Karnataka Enter Capital: Bangalore Enter State: Goa Enter Capital: Panjim Enter State: Tamil Nadu Enter Capital: Chennai ──────────────────────────────────── Method 1: Printing the dictionary The Created Dictionary is: {'Karnataka': 'Bangalore', 'Goa': 'Panjim', 'Tamil Nadu': 'Chennai'} ──────────────────────────────────── Method 2: Access Items The Items in the dictionary are: dict_items([('Karnataka', 'Bangalore'), ('Goa', 'Panjim'), ('Tamil Nadu', 'Chennai')]) ──────────────────────────────────── Method 3: Using get() Enter a State Name to get its Capital: Goa The Capital of: Goa is: Panjim ──────────────────────────────────── Method 4: Change Value Enter a State to change its Capital: Karnataka Enter the Capital: Bengaluru The updated Dictionary is: {'Karnataka': 'Bengaluru', 'Goa': 'Panjim', 'Tamil Nadu': 'Chennai'} ──────────────────────────────────── Method 5: Use len() The Length of the Dictionary is: 3 ───────────────────────────────────

×