[SOLVED] unction return values only working once in python

Issue

The code below runs and prints out the values returned from the two functions test_value(address) and checkRepeatCount(address) when i try to add the two value returned i None as the result. Anyway to fix this?


def check(address):
   
   ## define point variables
    pass_invalid_char = test_value(address)
    pass_repeat_count = checkRepeatCount(address)

    if pass_invalid_char == False:
        return print("Invalid character")
    else:
        pass
    
   total = pass_invalid_char+pass_repeat_count
   print(total)



check("hello")

Function 1 test_value

def test_value(value):
    return print(30)

Function 2 checkRepeatCount

def checkRepeatCount(value):
    return print(20)

Thats how im returning the function values

Solution

In both functions was returning a print statement with value

def test_value(value):
    return print(30)

I was supposed just to return the number on its own like so

def test_value(value):
    return 30

Answered By – Zayne komichi

Answer Checked By – Mildred Charles (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *