I'm used to seeing For Loops in this format:
for number in l: sum = sum + number
I was browsing some forums and came across this piece of code:
count_chars = ".arPZ" string = "Phillip S. is doing a really good job." counts = tuple(string.count(d) for(d) in count_chars) print counts I'm not sure if that is really a For loop, so I decided to rewrite it in a way that I understood:
tuple( for(d) in count_chars: string.count(d)) Needless to say, it failed lol. So can someone explain what is going on, and explain the folly of my logic? Thanks!!