#User defined function not printing

12 messages · Page 1 of 1 (latest)

umbral sphinx
#

As usual, this is for homework. I'm trying to get the result of the function to print. I can get it to work for lambda and non-user defined functions, along with a single input udf (def square(value): print(value**2)". It won't work once I add multiple elements.

surreal onyx
#

What does the curly braces syntax mean? {h} instead of just h for instance

umbral sphinx
#

I don’t know. It’s what my professor said to use on a different multi element udf

#

I tried a variant without them and got the same result

uneven hull
#

first when i did the exact same script you have it showed TypeError: unsupported operand type(s) for *: 'int' and 'set'

#
h = 0
q = 17
d = 24
n = 16
p = 12

def piggybank(h, q, d, n, p):
    print(50*h+25*q+10*d+5*n+1*p)

piggybank(h,q,d,n,p)

once i removed them from being sets it worked and here is the outcome

757

#

hope that answer helped

umbral sphinx
#

That helped immensely. Thank you

#

I also used it on a different udf that uses words as opposed to algebra and it worked great

#

And sorry about not copying and pasting my code. I just realized that you had to type that whole mess

uneven hull
#

XD i got lost midway typing that equation XD

fickle haloBOT