Print vs Return
print()
is a function called by a person. If you want to show the value to a person then you need to use the function print ()
.
return
is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.
12345678def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
Swipe to start coding
You need to implement a function named function_adding
. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23
, store the result in a variable sum
and return it.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 5.56
Print vs Return
Свайпніть щоб показати меню
print()
is a function called by a person. If you want to show the value to a person then you need to use the function print ()
.
return
is the Python keyword. When the program reaches the return keyword, Python stops the current function and sends the resulting value to where the function was called.
12345678def function(): a = 5 b = 2 c = a + b return c result = function() print(result)
Swipe to start coding
You need to implement a function named function_adding
. This function should calculate the sum of the next three numbers, such as a=5, b=455, c=23
, store the result in a variable sum
and return it.
Рішення
Дякуємо за ваш відгук!
Awesome!
Completion rate improved to 5.56single