What's new

Closed PYTHON Dictionaries

Status
Not open for further replies.
Ito naman sa akin paps..

Python:
#!/usr/bin/python3

fruits = [
  {"name": "Banana", "price": 4, "stock": 0},
  {"name": "Apple", "price": 2, "stock": 0},
  {"name": "Orange", "price": 1.5, "stock": 0},
  {"name": "Pear","price": 3, "stock": 0}
]

print("\n")

for i in range(len(fruits)):
 
  print('\tFruit: {} \n\tPrice: {} \n\tStock: {}\n'.format(fruits[i]['name'], fruits[i]['price'], fruits[i]['stock']))
 
print("\n")
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top