Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer in python Exercise 2: Complex Addition Compose a function addc which accepts two pairs of integers x and y and yields the sum
Please answer in python
Exercise 2: Complex Addition Compose a function addc which accepts two pairs of integers x and y and yields the sum of those two pairs interpreted as complex numbers. addc should return a pair of values of type float or int. You can create a pair of numbers, called a tuple, by including them inside of parentheses: (3,5). More on tuples [10]: #grade def addc(x,y): a = x[0] b = x[1] [11]: #Don't modify this cell run it to test your code #Tests are not exhaustive this is just a sanity check actual = addc((1,1),(1,2)) expected = (2,3) assert actual == expected, "Test case failed" print ("Success!")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