12_Find_length_of_dictionary.py


Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...


Code Snippet

def main():
    #create a dictionary to store teacher's details - such as their subject, hobby, school house, and more
    d={"Name": "Mr Moose","Subject": "Philosophy","Hobby":"Chess","School House":"Red House"}

    #find the length of the dictionary
    print("This is how many key,value pairs you have in the dictionary: ", len(d))

        
main()
                    

Try it yourself