Search Results

Search found 1 results on 1 pages for 'markum'.

Page 1/1 | 1 

  • Counting amount of items in Pythons 'for'

    - by Markum
    Kind of hard to explain, but when I run something like this: fruits = ['apple', 'orange', 'banana', 'strawberry', 'kiwi'] for fruit in fruits: print fruit.capitalize() It gives me this, as expected: Apple Orange Banana Strawberry Kiwi How would I edit that code so that it would "count" the amount of times it's performing the for, and print this? 1 Apple 2 Orange 3 Banana 4 Strawberry 5 Kiwi

    Read the article

1