Sep-30-2019, 09:28 PM
As Ichabod stated, the functions need to have values for their arguments; there's no way around it. However, there are a couple addition items to change to accomplish your goal.
Line 48 won't work. A for loop only works on objects with a __next__() method. This line will raise a NoneType error, most likely. For your desired outcome, you don't need a for loop at all; the variables "a" and "b" are already there.
Lines 49 - 51 will print a memory location instead of the output of the functions. This is due to the functions being referenced but not called. To call them, parentheses are needed afterward along with their argument values.
Line 52 will print "None" because skrivBeregninger() does not return a value. You may want to return all three functions in a tuple from skrivBeregninger().
Line 48 won't work. A for loop only works on objects with a __next__() method. This line will raise a NoneType error, most likely. For your desired outcome, you don't need a for loop at all; the variables "a" and "b" are already there.
Lines 49 - 51 will print a memory location instead of the output of the functions. This is due to the functions being referenced but not called. To call them, parentheses are needed afterward along with their argument values.
Line 52 will print "None" because skrivBeregninger() does not return a value. You may want to return all three functions in a tuple from skrivBeregninger().
def skrivBeregninger(): a=input ("Skriv inn tall 1: ") b=input ("Skriv inn tall 2: ") return (addisjon(a, b), subtraksjon(a, b), divisjon(a, b))