## lets create a dictionary
biodata={"name":"Aamir","age":"25","ms":"unmarried"}
print(biodata)
##to add details
biodata["blood" ]="o+"
print(biodata)
## to get details
print(biodata["name"])
##1:-others from of dictionary
country={"india":"delhi","usa":"wdc"}
print(country)
##in case of numbers:-remeber this about string concept.
numbers={1:2,3:4,5:6}
print(numbers)
##2:-other form of dictionary:-##dict(list of tuple pairs)
currency=[("rupee","india"),("dollar","usa")]
print(currency)
##in case of numbers here
squares={1:1,2:4,3:9}
print(squares)
##all praise to be Allah
"C:\Users\darul Haram\PycharmProjects\pythonProject2\venv\Scripts\python.exe" "C:/Users/darul Haram/PycharmProjects/pythonProject2/venv/Lib/Dictionary.py"
{'name': 'Aamir', 'age': '25', 'ms': 'unmarried'}
{'name': 'Aamir', 'age': '25', 'ms': 'unmarried', 'blood': 'o+'}
Aamir
{'india': 'delhi', 'usa': 'wdc'}
{1: 2, 3: 4, 5: 6}
[('rupee', 'india'), ('dollar', 'usa')]
{1: 1, 2: 4, 3: 9}
Process finished with exit code 0
Comments
Post a Comment