Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Is this right? (Python)

intA = 5

intB = 6

intC = 3



def equation():

intA * intB + intC;


def result():

print(equation)


print(result)


It doesn't print out the result....

Answers

  • Sl0thSl0th Member
    edited September 2020

    Hey, it should say

    print(equation())


    Also, it shouldn't be

    print(result)

    it should be

    result()

    (so no print() call)


    Remember () when calling functions.

  • It outputs as "None", what should i do?

  • HNJHNJ Member
    edited September 2020

    you should do like this

    intA = 5
    intB = 6 
    intC = 3 
    
    def equation():
    
        return intA * intB + intC    #The semi colon (;) is not used in python for line endings
    
    
    def result():
    
        return equation() #calling this function will return 
    
    
    print(result()) #result function is also called
    
    #or you can direcly do in result
    
    def result():
        print(equation())
    
    result()  #as the result function automatically prints
    
Sign In or Register to comment.