Is it possible to return a variable and use it...?

Nathan Pinno MadComputerGuy at gmail.com
Sun Mar 2 23:15:10 EST 2008


Hello all,

Is it possible to return a variable and then use it like the
following:
[code]
dir exp_1:
    while hen != "*"
       sum = sum + hen
    return sum

dir exp_2:
   if sum >= total_needed:
     print "Profit can be made."
   else:
     print "Expect a loss."

total_needed = int(raw_input("What is the total eggs needed? "))
hen = int(raw_input("How many eggs did each hen lay? Enter them in 1
by 1 or enter * when done. "))
exp_1
exp_2

[/code]

If not, then how do I do so?

Thanks,
Nathan P.



More information about the Python-list mailing list