Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to iterate set in python

dishes = {"Parotta","Chappathi","Beef Curry"}
for dish in dishes:
  print(dish)
#Parotta
#Chappathi
#Beef Curry

#To make your code look more "Pythonic" :)
dishes = {"Parotta","Chappathi","Beef Curry"}
for key,dish in enumerate(dishes):
  print(dish)
#Parotta
#Chappathi
#Beef Curry
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #iterate #set #python
ADD COMMENT
Topic
Name
7+3 =