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

Add first python file and new text file #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add first python file and new text file #13

wants to merge 1 commit into from

Conversation

roeyfredi
Copy link

No description provided.

print (mostapperdword)
print(max(d.values()))

print(f'The word that returns most times in the text file is: ' +mostapperdword+ ' and it returns ' ,max(d.values()))
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax error

@@ -0,0 +1,21 @@
text = open('text.txt', 'r')
Copy link
Contributor

Choose a reason for hiding this comment

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

opened file need to closed. best practice is to use "with...open..."

@@ -0,0 +1,21 @@
text = open('text.txt', 'r')
d = dict()
Copy link
Contributor

Choose a reason for hiding this comment

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

variable name should be meaningful

for key in list(d.keys()):
print(key, ":", d[key])

mostapperdword=max(d,key=d.get)
Copy link
Contributor

Choose a reason for hiding this comment

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

according to python style guide, var name should look like this: most_apperd_word

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