-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: master
Are you sure you want to change the base?
Conversation
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())) |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
No description provided.