Answers for "dict value python"

5

dictionary in python

d = {'key1':'value1','key2':'value2'}
print(d) # to print full dictionary
l=d.keys
print(l)   # to print keys
b=d.values
print(b)#to print values in dictionary
Posted by: Guest on November-04-2020
3

dictionary in python

# Dictionaries in Python

ages = {"John": 43, "Bob": 24, "Ruth": 76} # Marked by { at beginning and a } at end

# ^^^ Has sets of keys and values, like the 'John' and 43 set. These two values must be seperated by a colon

# ^^^ Sets of values seperated by commas.
Posted by: Guest on October-18-2020
-1

dict value python

obj = {0:"hello", 1:"there"}
print(obj[0])
print(obj[1])

print("\n\n\n\n\n")

for i in range(len(obj)):
  print(obj[i])
Posted by: Guest on February-18-2021

Python Answers by Framework

Browse Popular Code Answers by Language