Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Complex numbers

This assigment comprises of applying the basics of python to create your own complex number calculator.

Task 1:

Define a class called complex_number which accepts 2 parameters:

  • x: int64, float64, represents real component of the complex number
  • y: int64, float64, represents imaginary component of the complex number

Example, complex_numbers(3, 5) means 3 is the real part of the complex number and 5 is the imaginary part of the complex number. Such a number is represented as 3 + 5i.

Questions:

Define the following operations for the class:

  • '+' (complex number addition)

  • '-' (complex number subtraction)

  • '*' (complex number multiplication)

  • '/' (complex number division)

  • Note that these operations should be compatible with int and float datatypes as well

Also, define the following methods.

  • abs() that returns absolute value of the complex number
  • argument() that returns argument of the complex number
  • conjugate() that returns conjugate of the complex number