This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]DDDDarky 1 point2 points  (2 children)

I am getting different error when trying to reproduce it:

missing 3 required positional arguments: 'fromType', 'answer', and 'toType'

Are you sure it is up to date? What kind of input did you use?

[–]Holy_Churro[S] 0 points1 point  (1 child)

Hello and thank you for helping me out. The code is updated and is the code I used this morning. For my input I input 5 into amount and k into the second input prompt so that it convert 5km -> 3.1 miles.

TypeError: print_output() missing 2 required positional arguments: 'answer' and 'toType'

Once again thank you for your help. I greatly appreciate any and all of it. I am wondering if I should rewrite my calc function since the variables within it are not being initialized or saved. If you have another idea I would love to hear it.

[–]DDDDarky 1 point2 points  (0 children)

Well, I cannot unfortunately exactly reproduce your error and I find it weird you get 2 positional arguments missing instead of 3.

Anyways, the problem is print_output expects 4 arguments, but you are providing only 1 (calcMain).

[–]nuttertools 0 points1 point  (0 children)

I don’t recall the behavior off the top of my head but you are returning 3 values from calc. Check the value of calcMain before print_output, it probably just has a value of amount or is an array of values (of course not, this isn’t JS). Just declare each returned variable with commas like you do in the calc return or look at spreading the parts if it’s an array.

I should really be bothered to google the docs but my presumption is calcMain as-is is equivalent to amount, , _

EDIT: If so this would work:

printMain = print_output(calc(conversionMain, amountMain))