prices = {"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3}
def f(s):
for key in prices:
print "apple"
[_X_]
print f(prices)
what the different between ( return & print ) as a result of print --> f(prices)
when x = print " prices %f" %(prices["apple"])
and x = return " prices %f" %(prices["apple"])
The result in return case, output = one line
while in print case, output = 4 or many lines equal to len(prices)
;
and thank you
Created at: 2016/02/03 10:26; Updated at: 2016/02/06 19:34