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,890 points
222 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,230 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, 2019 in Python by Vinod
236 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, 2019 in Python by Fata
• 1,050 points
42 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, 2019 in Python by anonymous
49 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, 2019 in Python by Iris
140 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
• 69,000 points
916 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, 2019 in Python by Nymeria
• 3,540 points
121 views
0 votes
1 answer
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,230 points
49 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,230 points
75 views