Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1805

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Develop #1805

wants to merge 5 commits into from

Conversation

TomasShelbi-hub
Copy link

No description provided.

app/main.py Outdated
Comment on lines 17 to 21
counter = 0
for i in range(len(phrase)):
if phrase[i].lower() in letter.lower():
counter += 1
return counter
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to write it in one line
use count

app/main.py Outdated
Comment on lines 2 to 3
return sum([1 for i in range(len(phrase))
if phrase[i].lower() == letter.lower()])

Choose a reason for hiding this comment

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

You should use method count of string.
https://www.w3schools.com/python/ref_string_count.asp

Copy link
Author

Choose a reason for hiding this comment

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

i don`t understand
what i have do.

Choose a reason for hiding this comment

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

You should improve your code with using method count of string. Something like this

Suggested change
return sum([1 for i in range(len(phrase))
if phrase[i].lower() == letter.lower()])
return phrase.lower().count(letter.lower())

Copy link
Author

Choose a reason for hiding this comment

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

amazing! thank you

app/main.py Outdated
Comment on lines 2 to 3
return sum([1 for i in range(len(phrase))
if phrase[i].lower() == letter.lower()])

Choose a reason for hiding this comment

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

You should improve your code with using method count of string. Something like this

Suggested change
return sum([1 for i in range(len(phrase))
if phrase[i].lower() == letter.lower()])
return phrase.lower().count(letter.lower())

Copy link

@LLkaia LLkaia left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants