Skip to content

puneet-kaushal/Playing-with-dictionaries-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Playing-with-dictionaries-python

Key features of this code

  1. Keys and values are feteched using different ways
  2. First Way includes, join and format with dictionary.items()
  3. Second way includes key, values and dictionary.items()
  4. Third way includes using the methods of the dictioanries

Please have a look at the below image

dictionary500x300

Implementing ways with code

First Way

print("First way:")
print (' '.join(['{0}:{1}'.format(k, v) for k,v in data.items()]))
print("Second way:")
playing_with_python.py

Second Way

for key,value ikeys = data.keys()
values = data.values()
print(keys,values,end=" ")n data.items():
    print(key,value,sep=":",end=" ")

Third Way

keys = data.keys()
values = data.values()
print(keys,values,end=" ")

How to run this file

Since this is a python file, hence it can be run using following command

python playing_with_python.py
python3 playing_with_python.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages