Skip to content

Commit 4e1582e

Browse files
authored
Update ClassesDealingwithComplexNumbers.py
removed comments
1 parent fdf70b8 commit 4e1582e

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

Classes/ClassesDealingwithComplexNumbers.py

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,11 @@
88
Updated : 30 August 2022
99
Problem : https://www.hackerrank.com/challenges/class-1-dealing-with-complex-numbers/problem
1010
'''
11-
# Enter your code here. Read input from STDIN. Print output to
12-
13-
14-
# c_str_ar= input().strip().split()
15-
# d_str_ar= input().strip().split()
16-
17-
# def custom_print(n):
18-
# r=n.real
19-
# i=n.imag
20-
# ret_str=""
21-
# if(i==0 and r==0):
22-
# ret_str="0.00"
23-
# elif(r==0):
24-
# tmp_str="%.2f" %i
25-
# ret_str=tmp_str+"i"
26-
# elif(i==0):
27-
# tmp_str="%.2f" %r
28-
# ret_str=tmp_str
29-
# else:
30-
# tmp_str1="%.2f" %r
31-
# tmp_str2="%.2f" %i
32-
# if(i>0):
33-
# ret_str=tmp_str1+" + "+tmp_str2+"i"
34-
# else:
35-
# i=i*-1
36-
# tmp_str2="%.2f" %i
37-
# ret_str=tmp_str1+" - "+tmp_str2+"i"
38-
# print(ret_str)
39-
40-
# cr=float(c_str_ar[0])
41-
# ci=float(c_str_ar[1])
42-
# dr=float(d_str_ar[0])
43-
# di=float(d_str_ar[1])
44-
# c=complex(cr,ci)
45-
# d=complex(dr,di)
46-
47-
# val_add=c+d
48-
# val_sub=c-d
49-
# val_mul=c*d
50-
# val_div=c/d
51-
# mod_c=abs(c)
52-
# mod_d=abs(d)
53-
54-
# custom_print(val_add)
55-
# custom_print(val_sub)
56-
# custom_print(val_mul)
57-
# custom_print(val_div)
11+
import math
5812

59-
# print("%.2f" %mod_c)
60-
# print("%.2f" %mod_d)
61-
# Above code is not accepted on hackerrank, There's error somewhere in the above code. One may correct the error and keep the solution the way it was created. For now I'm adding mine, they way Hackerrank asks to solve it.
6213

63-
import math
6414

65-
class Complex(object):
15+
class Complex():
6616
def __init__(self, real, imaginary):
6717
self.real = real
6818
self.imaginary = imaginary
@@ -96,7 +46,7 @@ def __str__(self):
9646
else:
9747
result = "%.2f-%.2fi" % (self.real, abs(self.imaginary))
9848
return result
99-
49+
10050
if __name__ == '__main__':
10151
c = map(float, input().split())
10252
d = map(float, input().split())

0 commit comments

Comments
 (0)