Question: Write a function named that takes in two strings, and returns if they are different and False if they are the same. Capitalization matters, is



Write a function named that takes in two strings, and returns if they are different and False if they are the same. Capitalization matters, is not the same as for this function. And they are not the same in terms of string comparison with (so you basically don't need to worry about it). Hints Boolean expressions will be useful here. Just like arithmetic expressions and values, you can store boolean values and the results of boolean expressions in variables, e.g., allows you to force a guarantee about the state of your code beyond a point (by terminating the program if that guarantee is not met). We can use this for testing, but we can also use to it to reject illegal inputs to a function. We want to ensure that the inputs to the different_names () are both strings (type equal to str). So can add asserts requiring this to be so. This way, if the inputs are not strings, then you get a clear termination of the program with an error message and not have less clear error or quiet misbehavior. So add to this function to ensure the inputs are of type These should be at the beginning of the function, like in the second code block in the preamble section. Note: You are editing the existing function, not making a new one. Hints If it hasn't come up, there is function called that gives you the type of something. And the result of that can be compared against something like See the preamble for an example. Write a function named that takes in three strings, and returns True if they are all different from each other and if any two are the same. Capitalization still matters (e.g., "Joe" and "joe" are different in the eyes of this function and the operator). Hints You can use your implementation of if you'd like. Testing 2.2. Add asserts to three_unique_names () (1 point) Add s to this function to ensure the inputs are of type st.r. You want to ensure an assertion error is any of the three inputs are not of type These should be at the beginning of the function, like in the second code block in the preamble section. Note: You are editing the existing function, not making a new one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
