## Classes: Dealing with Complex Numbers python

For this challenge, you are given two complex numbers, and you have to print the result of their addition, subtraction, multiplication, division and modulus operations. The real and imaginary precision part should be correct up to two decimal places. Input Format One line of input: The real and imaginary part of a number separated by a space. Output Format For two complex numbers C and D, the output should be in the following sequence on separate lines: 1. C+D 2. C-D 3. C*D

View Solution →## Class 2 - Find the Torsional Angle python

You are given four points A,B,C and D in a 3-dimensional Cartesian coordinate system. You are required to print the angle between the plane made by the points A,B,C and B,C,D in degrees(not radians). Let the angle be PHI. Cos(PHI) = (X.Y) / |X| |Y| where X=AB x BC and Y= BC x CD. Here, X.Y means the dot product of X and Y, and AB x BC means the cross product of vectors AB and BC. Also, AB = B-A. Input Format One line of input containing the space separated floating number values

View Solution →## Zipped! python

zip([iterable, ...]) This function returns a list of tuples. The th tuple contains the th element from each of the argument sequences or iterables. If the argument sequences are of unequal lengths, then the returned list is truncated to the length of the shortest argument sequence. Sample Code >>> print zip([1,2,3,4,5,6],'Hacker') [(1, 'H'), (2, 'a'), (3, 'c'), (4, 'k'), (5, 'e'), (6, 'r')] >>> >>> print zip([1,2,3,4,5,6],[0,9,8,7,6,5,4,3,2,1]) [(1, 0), (2, 9), (3, 8), (4, 7), (

View Solution →## Input() python

input() In Python 2, the expression input() is equivalent to eval(raw _input(prompt)). Code >>> input() 1+2 3 >>> company = 'HackerRank' >>> website = 'www.hackerrank.com' >>> input() 'The company name: '+company+' and website: '+website 'The company name: HackerRank and website: www.hackerrank.com' Task You are given a polynomial P of a single indeterminate (or variable), x. You are also given the values of x and k. Your task is to verify if P(x) = k. Constraints

View Solution →## Python Evaluation

The eval() expression is a very powerful built-in function of Python. It helps in evaluating an expression. The expression can be a Python statement, or a code object. For example: >>> eval("9 + 5") 14 >>> x = 2 >>> eval("x + 3") 5 Here, eval() can also be used to work with Python keywords or defined functions and variables. These would normally be stored as strings. For example: >>> type(eval("len")) <type 'builtin_function_or_method'> Without eval() >>> type("len") <type

View Solution →