1 # Dictionary as follows 2 Movie = { 3 ' demon cat pass ' : [ ' yellow ' , ' dyed ' ], 4 ' No-East West ' : [ ' chapter ' , ' king ' ], 5 ' Macross ' : [ ' Ray ' , ' Tong ' ] . 6 } . 7 name = iNPUT ( " Please enter the name of the actor ') # Collect information 8 for I in movie: # traversing the dictionary movie key name . 9 actor = movie [I] # Set a variable actor equal traversed dictionary value 10 IF name in actor: # If the names of actors entered value traversal . 11 Print (name + ' starred ' + i) # print name (actor name), i is the key name
The results are as follows:
Please enter the actor's name Lei
Lei appeared Macross
Process finished with exit code 0