How do I access the index in a for loop like the following?
ints = [8, 23, 45, 12, 78]
for i in ints:
print('item #{} = {}'.format(???, i))
I want to get this output:
item #1 = 8
item #2 = 23
item #3 = 45
item #4 = 12
item #5 = 78
When I loop through it using …
Here's my code:
import math
print "Hey, lets solve Task 4 :)"
number1 = input ("How many digits do you want to look at? ")
number2 = input ("What would you like the digits to add up to? ")
if number1 == 1:
cow = range(0,10)
elif number1 == 2:
cow = …