33_Copy_a_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
    d1={"Name": "Mr Moose","Subject": "Philosophy","Hobby":"Chess","School House":"Red House"}
    d2=d1.copy()
    print("New Dictionary that has been copied:", d2)

    
        
main()
                    

Try it yourself