Python Loops

dog_breeds = [‘french_bulldog’, ‘dalmatian’, ‘shihtzu’, ‘poodle’, ‘collie’]

for breed in dog_breeds:

print(breed)

I want to know from where “breed” come from? is it variable which we declared ?

Hello @byte9145198756, welcome to the forums!

Yes, breed is a variable, which you declared here:

for breed in dog_breeds
  # ^^^^^
  #this is where you declared the variable

It could be replaced with any other variable name:

for somelongandrandomvariablename in dog_breeds:
#code

I hope this helps!

4 Likes