0
keyword argument
i keep getting no output how do i fix this water= [] def get_last_water_value(): return water [-1] def add_value(transaction_amount, last_transaction= [1]): water.append ([last_transaction, transaction_amount]) add_value (2) add_value (last_transaction= get_last_water_value(),transaction_amount=0) add_value (10.89, get_last_water_value())
4 Antworten
0
I get
[[[1], 2], [[[1], 2], 0], [[[[1], 2], 0], 10.89]]
should i have 3 rows instead of one
0
nvm i see what you are saying
water= []
def get_last_water_value():
return water [-1]
def add_value(transaction_amount, last_transaction= [1]):
water.append ([last_transaction, transaction_amount])
print(water)
add_value (2)
add_value (last_transaction= get_last_water_value(),transaction_amount=0)
add_value (10.89, get_last_water_value())
0
now i get
[[[1], 2]]
[[[1], 2], [[[1], 2], 0]]
[[[1], 2], [[[1], 2], 0], [[[[1], 2], 0], 10.89]]
thanks