Please help me make a cycle that will be from the list of fruits
fruits= ["apple", 'orange', 'pineapple']
print each value and add a sequential number to get
 apple
 orange
 pineapple
Thanks in advance, and sorry for this likely easy task for you.)

Answer # 1
You can use the generator to solve the problem in one line. And thus, save memory if the list is very large:
fruits= ["apple", 'orange', 'pineapple'] [print (f '{number + 1}. {fruit}') for number, fruit in enumerate (fruits)]
Conclusion:
1. apple 2. orange 3.pineapple

Answer # 2
You can use the generator to solve the problem in one line. And thus, save memory if the list is very large:
fruits= ["apple", 'orange', 'pineapple'] [print (f '{number + 1}. {fruit}') for number, fruit in enumerate (fruits)]
Conclusion:
1. apple 2. orange 3.pineapple

Answer # 3
fruits= ["apple", 'orange', 'pineapple'] for number, fruit in enumerate (fruits, 1): print (number, fruit) # 1 apple # 2 orange # 3 pineapple

Answer # 4
fruits= ["apple", 'orange', 'pineapple'] for number, fruit in enumerate (fruits, 1): print (number, fruit) # 1 apple # 2 orange # 3 pineapple

Answer # 5
fruits= ["apple", 'orange', 'pineapple'] for i in range (0, len (fruits)): print (i + 1, fruits [i], sep= '.')

Answer # 6
fruits= ["apple", 'orange', 'pineapple'] for i in range (0, len (fruits)): print (i + 1, fruits [i], sep= '.')

Answer # 7
Even a very primitive question, index by index.
fruits= ["apple", 'orange', 'pineapple'] for i in range (len (fruits)): print ("" + str (i + 1) + "." + fruits [i])

Answer # 8
Even a very primitive question, index by index.
fruits= ["apple", 'orange', 'pineapple'] for i in range (len (fruits)): print ("" + str (i + 1) + "." + fruits [i])

Answer # 9
there are several ways:
via
enumerate
, which itself will add sequential indices to the elementsfruits= ["apple", 'orange', 'pineapple'] for obj in enumerate (fruits, 1): print (f "{obj [0]}. {obj [1]}")
or through a normal index pass:
for i in range (len (fruits)): print (f "{i + 1}. {fruits [i]}")

Answer # 10
there are several ways:
via
enumerate
, which itself will add sequential indices to the elementsfruits= ["apple", 'orange', 'pineapple'] for obj in enumerate (fruits, 1): print (f "{obj [0]}. {obj [1]}")
or through a normal index pass:
for i in range (len (fruits)): print (f "{i + 1}. {fruits [i]}")

Answer # 11
# mark fruits= ['apple', 'orange', 'pineapple'] n= 0 for fruit in fruits: # We iterate over all fruits and add a number n += 1 print (str (n) + '.' + fruit)

Answer # 12
# mark fruits= ['apple', 'orange', 'pineapple'] n= 0 for fruit in fruits: # We iterate over all fruits and add a number n += 1 print (str (n) + '.' + fruit)
 python : You need to add one element at a time to nested lists from another list
 python : How to reverse a list?
 python : Confusing structure of referring to elements
 Output two random values from two lists python
 python : Pyautogui text input not working
 python : Regular cleaning to identify the phone number
 python convert list
 How to add a file to FTP via python
 python : How to catch an event that a user in a telegram group invited a person to chat
 python : Can't run script problem with import re
print (list (map (lambda x: f '{x [0] + 1}. {x [1]}', enumerate (fruits))))
entithat20211122 02:33:12