Member Avatar for Patrick.Barklem

Hi there, im relatively new to python and i just can't figure out parameters... Any help with this code?

def main():
getInputs()
answer = calculateWork()
print (answer)

def getInputs(a,b):
num1 = int(input("Please enter your first number: "))
num2 = int(input("Please enter your second number "))
return num1,num2

def calculateWork():
return a*b

I'm really stuck on how to pass variables...

Take a look at this ...

def main():
    # getInputs() returns num1 an num2
    num1, num2 = getInputs()
    # calculateWork(num1, num2)
    # needs num1 and num2 arguments
    # and returns answer
    answer = calculateWork(num1, num2)
    print (answer)

def getInputs():
    num1 = int(input("Please enter your first number: "))
    num2 = int(input("Please enter your second number "))
    return num1, num2

def calculateWork(a, b):
    return a*b

main()
Member Avatar for Patrick.Barklem

Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.