🔒 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: 14
Status
Not open for further replies.

About this Thread

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

Trending Topics

Online now

Members online
1,097
Guests online
6,323
Total visitors
7,420

Forum statistics

Threads
2,354,277
Posts
29,383,027
Members
1,079,397
Latest member
tobzlim3
Back
Top