Python Forum
Function returns unaccurate value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function returns unaccurate value
#1
This is an example of an issue that I have:

why if a function calls another function the return of the called function is not accurate:

I have inserted some print instructions to evidence the outputs. thank you for your help.
def multiplicacion(a,b):
    producto = a*b
    print producto
    if a>b:
        return producto
    if b>a:
        a += 1
        multiplicacion(a,b)
    print str(producto) + "END"
    return producto


def maths(a, b):
    pluss = multiplicacion(a,b)
    print str(pluss) + " end "

maths(5, 6)
Reply


Messages In This Thread
Function returns unaccurate value - by raulfloresgp - Nov-23-2018, 12:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  function returns dataframe as list harum 2 1,490 Aug-13-2022, 08:27 PM
Last Post: rob101
  function accepts infinite parameters and returns a graph with those values edencthompson 0 890 Jun-10-2022, 03:42 PM
Last Post: edencthompson
  function that returns a list of dictionaries nostradamus64 2 1,805 May-06-2021, 09:58 PM
Last Post: nostradamus64
  Recursive function returns None, when True is expected akar 0 3,434 Sep-07-2020, 07:58 PM
Last Post: akar
  Python function returns inconsistent results bluethundr 4 3,278 Dec-21-2019, 02:11 AM
Last Post: stullis
  Function returns "NoneType" eoins 3 5,290 May-22-2019, 10:43 PM
Last Post: micseydel
  Function returns memory address Joeicam 1 3,855 Feb-10-2019, 02:23 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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