(+84) 236.3827111 ex. 402

Hàm mở rộng trong Python


Viết 1 hàm dienThoai trong python để
Input : dienThoai(samsung =1000, iphone = 20000, nokia = 15000)
Output:
samsung 1000
iphone 20000
nokia 15000
---------------------
tong = 36000
#code Python
def dienThoai(**data):
tong =0;
for a, b in data.items():
tong = tong + b
row = "{:10}{:10}".format(a,b)
print(row)
return tong
tong =dienThoai(samsung =1000, iphone = 20000, nokia = 15000)
print("-" *20)
print("{:10}{:10}".format("tong =",tong))