0

I'm learning functions and I don't understand why I have this: we are taught to use "return" instead of "print" to be able to use the function in several cases.

Except that in the basic functions below, the return doesn't show any result, but if I replace the return by a "print", I get the result.

How to display the result of the return without a print? I can't find a solution


def el_divisor(number_1, number_2):
  return (number_1 / number_2)

el_divisor(5, 2)


def el_additionator(number_1, number_2):
  return (number_1 + number_2)

el_additionator(5,  2)


def substraction(nb, nb_to_substract):
  return (nb - nb_to_substract)

substraction(5, 2)

Geoffrey
  • 27
  • 4

2 Answers2

-2

enter image description here

Using Ipython IDE like will help you.

-3

Kindly do like below.

def el_divisor(number_1, number_2):
  return (number_1 / number_2)

print(el_divisor(5, 2))


def el_additionator(number_1, number_2):
  return (number_1 + number_2)

print(el_additionator(5,  2))


def substraction(nb, nb_to_substract):
  return (nb - nb_to_substract)

print(substraction(5, 2))