Skip to content

Update for.py#11

Open
josephinemagu wants to merge 1 commit into
wwangwe:mainfrom
josephinemagu:patch-1
Open

Update for.py#11
josephinemagu wants to merge 1 commit into
wwangwe:mainfrom
josephinemagu:patch-1

Conversation

@josephinemagu
Copy link
Copy Markdown

No description provided.


people= ['John Doe', 'Jane Doe', 'Josephine Magu']
for name in range(len(people)):
print('Current person:', people[index]))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index is undefined, I believe you meant name

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are looping in respect to the range which is the length of the list, instead, you can iterate over the list like this.

people= ['John Doe', 'Jane Doe', 'Josephine Magu']
for person in people:
	print('Current person: ', person))

@wwangwe wwangwe force-pushed the main branch 2 times, most recently from 7febef0 to f34f868 Compare February 20, 2021 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants