🔒 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

  • python.webp
    python.webp
    44.5 KB · Views: 13
Status
Not open for further replies.

About this Thread

  • 22
    Replies
  • 2K
    Views
  • 6
    Participants
Last reply from:
S4BRETOOTH

Online now

Members online
591
Guests online
1,010
Total visitors
1,601

Forum statistics

Threads
2,275,069
Posts
28,960,429
Members
1,233,567
Latest member
vio321g
Back
Top