why does does code1 output all the values in the dictionary and code2 only outputs one item
my code1:
resources = {
"water": 300,
"milk": 200,
"coffee": 100, }
def available(dict):
for k,v in dict.items():
print(f'{k}:{v}')
available(resources)
output1:
water:300
milk:200
coffee:100
my code2
resources = {
"water": 300,
"milk": 200,
"coffee": 100,}
def available(dic):
for char in dic:
return f'{char}:{dic[char]}'
print((available(resources)))
output2
water:300