How can I declare a variable inside a function thats used more than once?

I am starting to use functions for my first time and the issue I am having is declaring a variable inside a function that is used more than once. I got this program working before my attempt to add functions, so the only thing incorrect (im assuming) is my attempt to use functions.

print ("Welcome to August's binary arithemetic caclulator.")
firstvalue = input("What is the first binary value?")
secondvalue = input("What is the second binary value?")
operation = input("What operation would you like to carry out? + or - or * or ^")

Note the only declared function, and the block of commented code. The code is identical with the exception of a single variable. So I am trying to execute the function twice, by changing the only difference the variable. The variable I would like to change can be seen as

firstvalue

in

def bintoint()

. For the second time the function is called, I would like

firstvalue

to be replaced with `secondvalue, just like the commented code.

The idea of this script is to take two binary values, convert them into integers, carry out the respective operation between the two integers, convert back into binary and

print ( firstvalue , operation , secondvalue , "=" ,result)

.

So lets say I input the two values in this order:

100

011

*

Expected Output:

100 * 011 = 1100

Actual Output:

TypeError: bintoint() got an unexpected keyword argument 'firstvalue'

So I understand it is something wrong with my attempt at changing the variable within the function.

bintoint(firstvalue="secondvalue")

I also tried without quotation marks but still gave me the same error.

Two important aspects of using functions are passing in arguments and returning the results. If you pass in an argument, then the function will receive a potentially different value each time it is called. If you return the result, then the calling code will receive a different answer each time it calls your function.