Python Forum
how to use the return function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use the return function
#6
How are you running that? If you run it from the system command line, you won't see the return value. If you run it in the Python interpreter you should see the output. This is what I get in the interpreter:

Output:
>>> get_choice() Please make a choice (1-5): 3 3 >>>
Also note that you have to call it from within the interpreter to see it in the interpreter. In any case, if you change the call to print(get_choice()) you'll see the return value.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
how to use the return function - by NLittle17 - Jan-05-2019, 10:00 PM
RE: Functions in Python - by ichabod801 - Jan-05-2019, 11:44 PM
RE: Functions in Python - by NLittle17 - Jan-07-2019, 05:28 PM
RE: Functions in Python - by ichabod801 - Jan-07-2019, 05:34 PM
RE: Functions in Python - by NLittle17 - Jan-07-2019, 05:45 PM
RE: how to use the return function - by ichabod801 - Jan-08-2019, 12:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  nested function return MHGhonaim 2 774 Oct-02-2023, 09:21 AM
Last Post: deanhystad
  return next item each time a function is executed User3000 19 2,724 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  function return boolean based on GPIO pin reading caslor 2 1,351 Feb-04-2023, 12:30 PM
Last Post: caslor
  return vs. print in nested function example Mark17 4 1,915 Jan-04-2022, 06:02 PM
Last Post: jefsummers
  How to invoke a function with return statement in list comprehension? maiya 4 3,056 Jul-17-2021, 04:30 PM
Last Post: maiya
  Function - Return multiple values tester_V 10 4,810 Jun-02-2021, 05:34 AM
Last Post: tester_V
  Get return value from a threaded function Reverend_Jim 3 17,725 Mar-12-2021, 03:44 AM
Last Post: Reverend_Jim
  Return not exiting function?? rudihammad 3 5,544 Dec-01-2020, 07:11 PM
Last Post: bowlofred
  Why does my function return None? vg100h 3 2,354 Oct-29-2020, 06:17 AM
Last Post: vg100h
  how to keep a Popen instance existant in a function return? Skaperen 7 3,387 Sep-17-2020, 07:10 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020