Dec-11-2017, 09:38 PM
Also, you can iterate over a str type ( strings ).
So:
A lot of people who comes from other languages are doing this:
Use the forum to its full potential. Look at the code in the tutorials.
Welcome!
So:
for char in 'hello': print(char)
Output:h
e
l
l
o
This is the Python way. This is why I love Python. You have seen it in the previous posts I suppose. I really like how some people put an effort to explain something. Bravo to @DeaD_EyE!A lot of people who comes from other languages are doing this:
s = 'hello' for char in range( len (s)): print(char[0])It's ugly, clumsy and hard to read. I've seen it in a book teaching Python. Don't remember the title. And in the articles over the web too.
Use the forum to its full potential. Look at the code in the tutorials.
Welcome!