(Nov-26-2016, 05:12 AM)Millionsunz Wrote: What I don't seem to understand is why the function needs no argumentsBecause all input and calculation is inside the the function block.
(Nov-26-2016, 05:12 AM)Millionsunz Wrote: when I put in an argument, like arg1, I can put in a random value.You can put in whatever you want because you do not use argument in function.
Now is argument been used in function,and return total + argument(arg1).
def testadditon(arg1): fingers = input("How many fingers do you have?") toes = input("How many toes do you have?") total = fingers + toes return total + arg1 # Aliens has more fingers alien_fingers = 100 total = testadditon(alien_fingers) # to easily show what I mean print(total)To spilt it up so you see that one function is only returting,
and the other function to calculation.
def body_parts(): fingers = int(raw_input("How many fingers do you have?")) toes = int(raw_input("How many toes do you have?")) return fingers, toes def body_calc(body_parts): fingers, toes = body_parts() total = fingers + toes return total if __name__ == '__main__': print body_calc(body_parts)As a new user you should be thinking of using Python 3.
Then you don't need to think of int(raw_input()),because input() is not safe(python 2.x).