Quick question to understand variables after 'for'


#1



names = ["List"]
for names in names

I was able to get the code to work but I don't understand how you go about determing the variables between 'for' and 'in' and after 'in'. I see 'items' and other words being thrown around a lot and I'm just not getting it.

Thanks in advance!!


#2

The variable after for can be anything you want so long as it is not a reserved word and you use it consistently thereafter. The item after in will be the item through which you want to iterate.


#3

Oh gosh! Thanks! That definitely cleared things up a little. It was bugging me so bad. Just need a little more practice. You're quite the answer hero around here. Thanks for doing what you do =)

Get Outlook for Androidhttps://aka.ms/ghei36


#4

Nah, just an overzealous new guy trying to be helpful but not spoil the learning. Fare thee well.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.