0

whats the problem?

money1 = 100 money2 = 100 def moneyTransferFrom1To2(x): money1 - x money2 + x print (str(money1) + " , " + str(money2)) moneyTransferFrom1To2(30) print (str(money1) + " , " + str(money2))

6th Jul 2020, 8:15 PM
Yahel
Yahel - avatar
2 Answers
0
ty ,but what does the 'global' do? does it let you use the variables? like 'public' in java?
6th Jul 2020, 8:29 PM
Yahel
Yahel - avatar
0
~ swim ~ , you are right! but in this specific situation the code is really short and orginized , i dont think saving the code and sharing it in necesary... by the names of the few variables you can assume the code is for transfering "money" from one variable to the other.
6th Jul 2020, 8:36 PM
Yahel
Yahel - avatar