Number

Report a typo

Below you can see a function that reads a number from input and prints some information about that number.

def get_number_information():
    number = int(input("Enter a number:"))
    is_even = number % 2 == 0
    squared = number ** 2
    square_root = number ** 0.5
    opposite = -number
    inverse = 1 / number
    
    print("You entered", number)
    print("Information about this number:")
    print("Even:", is_even)
    print("Square =", squared)
    print("Square root =", square_root)
    print("Opposite =", opposite)
    print("Inverse =", inverse)
    

For the moment, all the operations we can do with our number, and all the information we can get about it is put into the single function get_number_information(). This is not very convenient.

Let's instead decompose this code into several functions. We will make a separate function for each mathematical operation.

Take a look at the names of the functions below, and choose the ones that we should create.

Select one or more options from the list
___

Create a free account to access the full topic