Skip to content

Commit 71740f0

Browse files
authored
Create Day-24_Complex_Numbers_Multiplication.py
1 parent 1b951c4 commit 71740f0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def complexNumberMultiply(self, num1: str, num2: str) -> str:
3+
a,b = num1.split('+')
4+
c,d = num2.split('+')
5+
a,c = int(a), int(c)
6+
b,d = int(b.strip('i')), int(d.strip('i'))
7+
8+
ans = str(a*c - d*b) + '+' + str(a*d+b*c) + 'i'
9+
10+
return (ans)
11+

0 commit comments

Comments
 (0)