From 7ec80a74e36a3c2adb3dd6290827f7f5df7cc523 Mon Sep 17 00:00:00 2001 From: madhavaneja <36835451+madhavaneja@users.noreply.github.com> Date: Fri, 5 Oct 2018 19:07:47 +0530 Subject: [PATCH] string formatting --- stringformat.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 stringformat.py diff --git a/stringformat.py b/stringformat.py new file mode 100644 index 00000000..4dd1e270 --- /dev/null +++ b/stringformat.py @@ -0,0 +1,5 @@ +import cmath +a=float(input('enter real part of complex number')) +b=float(input('enter imag part of complex number')) +c_sqrt=cmath.sqrt(complex(a,b)) +print('square root of {0:0.3f} + {1:0.3f}j is {2:0.3f} + {3:0.3f}j'.format(a,b,c_sqrt.real,c_sqrt.imag)) \ No newline at end of file