Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python
#7
Fiel Wrote:You can't enumerate over a number. You can enumerate over strings, arrays, and dictionaries as they are iterable.

Code:
Variable = "124612"
for i, eachVariable in enumerate(Variable):
    print(i + 2)

Code:
2
3
4
5
6
7

"x +=" is the same as "x = x +"
oh, ok.
Thanks for the help Big Grin
Reply


Messages In This Thread
Python - by Manu - 2011-03-30, 03:19 PM
Python - by Fiel - 2011-03-30, 03:40 PM
Python - by Manu - 2011-03-30, 03:54 PM
Python - by Fiel - 2011-03-30, 04:04 PM
Python - by Manu - 2011-03-30, 07:03 PM
Python - by Fiel - 2011-03-30, 07:16 PM
Python - by Manu - 2011-03-30, 08:11 PM
Python - by Manu - 2011-03-31, 08:16 PM
Python - by Fiel - 2011-04-01, 03:12 AM
Python - by Manu - 2011-04-01, 08:27 PM
Python - by Fiel - 2011-04-01, 08:38 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)