Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this exercise you will write a function that will evaluate any two Python objects in order to provide a numeric score indicating how closely
For this exercise you will write a function that will evaluate any two Python objects in order to provide a numeric score indicating how closely related they are. Create a file named
compare.py with a single function named compare. This function must take two arguments, and must return an integer satisfying the following requirements:
If the arguments contain references to the same object, return
If the arguments refer to different objects with same type and same value, return
If the arguments are the same type, but have different values, return
If the arguments are of different types, return
The following interaction provides some examples of the expected behavior.
#
#
#
comparea b # Same object.
compare # Different objects the same value.
compare # Same type, different values.
compared e # Different types.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started