What does the return statement do in Python?

0 votes

How do we use the return statement in Python and what is the purpose of it? Also, what is the difference between return statement and print statement?

Oct 1, 2018 in Python by ana1504.k
• 7,870 points
109 views

1 answer to this question.

0 votes

The print() function is use to write or "print" a string in the console whereas a return statement lets your function to exit and hand back a value to its caller.

The return statement in python is used when a function is ready to return a value to its caller.

answered Oct 1, 2018 by SDeb
• 13,180 points

Related Questions In Python

0 votes
1 answer

What does the random.triangular(low, high, mode) function do in python?

It returns a random floating point number ...READ MORE

answered May 27 in Python by Vinod
92 views
0 votes
1 answer

What to do when len() does not return the number of integers in range(1,100)?

You can use the following code block: x=range(1,100) len(x) Output: ...READ MORE

answered May 28 in Python by Fata
• 1,040 points
31 views
0 votes
1 answer

What does the map() method do in Python?

The map() function in Python is a ...READ MORE

answered Jun 17 in Python by anonymous
28 views
0 votes
1 answer

What does the penup() do in Python(turtle module)

penup() basically makes sure that the moving ...READ MORE

answered Jun 21 in Python by Iris
49 views
+3 votes
2 answers

What does Python _init_ and self do?

Hey @Anirudh!  Self The self keyword is used to access ...READ MORE

answered Oct 31, 2018 in Python by Omkar
• 67,660 points
277 views
+1 vote
1 answer

What does the Raise keyword do in Python?

Hi! I think I can answer this - ...READ MORE

answered Jan 25 in Python by Nymeria
• 3,520 points
78 views
0 votes
1 answer

What does hash do in python?

A hash is an fixed sized integer ...READ MORE

answered Oct 15, 2018 in Python by SDeb
• 13,180 points
38 views
0 votes
1 answer

What are the ternary conditional operator in Python?

The Ternary Conditional operator was added in ...READ MORE

answered Sep 19, 2018 in Python by SDeb
• 13,180 points
56 views