dictionary in python
dict = {"apple": "fruit", "ball": "object", "cricket": "sports"}
#how to print?
print(dict["cricket"])
dictionary in python
dict = {"apple": "fruit", "ball": "object", "cricket": "sports"}
#how to print?
print(dict["cricket"])
how to use dictionary in python
#dictionary
programming = {
"Bugs": "These are the places of code which dose not let your program run successfully"
,"Functions":"This is a block in which you put a peice of code"
,"shell":"This is a place where the code is exicuted"
}
print(programming["Bugs"])
print(programming["shell"])
#error
#print(programming["pugs"])
how to define a dictionary in python
population = {"Shanghai":17.8, "Istanbul":13.3, "Karachi":13.0, "Mumbai":12.5}
#Consider the following when creating a dictionary
# 1. Must be inside {}
# 2. Have two parts in an item
# Key - e.g. Istanbul and Value - e.g. 13.3
# 3. There must be a colon ":" between the key and the value
# 4. Item must be seperated by commas ","
# 3. Any immutable type can be used as keys (not only integers like in lists)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us