DEV Community

Saharan-sub
Saharan-sub

Posted on

Python IF statement

'>>> # Measure some strings:
... words = ['cat', 'window', 'defenestrate']

for w in words:
... print(w, len(w))
...
cat 3
window 6
defenestrate 12'


I want to assume that I know what lead to the output but I do not fully understand the if statement. What is the use of the variable "w" ?
I mean , what is it doing ?

Top comments (1)

Collapse
 
godwin_france profile image
Saharan-sub

wow, makes sense now!

Thank you