Python Forum
Function not returning expected value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function not returning expected value
#5
Thank you all for your replies, I think I get it now - I thought that when you called a function from within itself that it would essentially be looping around... but I guess it's essentially starting a 'new' function, so the value of the variable 'answer' in the original function would stay unchanged.

stullis - that's quite similar to how I re-wrote it in the end, although you've managed to do it in a few less steps than me :)

I'm starting to really appreciate how complex coding can be... even the simplest little task can be written in hundreds of different ways! :/
Reply


Messages In This Thread
Function not returning expected value - by Euqinu - Sep-09-2018, 09:25 PM
RE: Function not returning expected value - by Euqinu - Sep-10-2018, 12:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why my function is returning None? PauloDAS 6 1,754 Jul-17-2022, 11:17 PM
Last Post: Skaperen
  Pausing and returning to function? wallgraffiti 1 2,154 Apr-29-2021, 05:30 PM
Last Post: bowlofred
  Why is the function returning None for a * b instead of number? omm 10 4,283 Nov-05-2020, 01:17 PM
Last Post: omm
  Recursive function returns None, when True is expected akar 0 3,380 Sep-07-2020, 07:58 PM
Last Post: akar
  Having hard time understanding the function self-returning itself twice jagasrik 2 2,478 Aug-15-2020, 08:50 PM
Last Post: deanhystad
  Returning Value from Function with Trackbars vicpylon 3 2,054 May-24-2020, 11:28 PM
Last Post: bowlofred
  Nested Recursive Function not Returning Etotheitau 2 2,251 May-09-2020, 06:09 PM
Last Post: Etotheitau
  Function not returning correct value ActualNoob 3 2,685 Jan-11-2019, 12:35 AM
Last Post: stullis
  zip() function does not work as expected AyCaramba 1 7,401 Jan-31-2018, 05:25 PM
Last Post: Gribouillis
  Recursive function not returning expected output...(Python speech recog module) bigmit37 4 5,865 Jan-10-2017, 02:13 PM
Last Post: bigmit37

Forum Jump:

User Panel Messages

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