Python begineers

1.def say_hi(name,age):
    print("Hi " + name + " You are " + age)

say_hi("Mike", "36")
say_hi("John", "38")

2.def say_hi(name,age):
    return("Hi " + name + " You are " + age)

print(say_hi("Mike", "36"))
print(say_hi("John", "38"))

3.def say_hi(name,age):
    return("Hi " + name + " You are " + age)

say_hi("Mike", "36")
say_hi("John", "38")

4.def cube(num):
    print(num*num*num)

cube(3)

5.def cube(num):
  return(num*num*num)

print(cube(3))

i am having confusion with the print and return statements. On the above codes i tried various variations of return and print, but i am still confused when to use return and print and which is more reliable.

Print just writes the output to the terminal. Return lets you save the output to a variable.

num_cubed = cube(5)

for example