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

Python challenge- HW #15

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

Python challenge- HW #15

wants to merge 4 commits into from

Conversation

morbitton
Copy link

HomeWork Python
@AviadP

HW python.py Outdated
@@ -0,0 +1,16 @@
#my code:

with open('text.txt') as file:
Copy link
Contributor

Choose a reason for hiding this comment

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

with...open... context should only include file operation

Copy link
Author

Choose a reason for hiding this comment

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

@AviadP I changed the file mode - read mode

Copy link
Contributor

Choose a reason for hiding this comment

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

pls use "with..open..." context manager, as explained in class

Copy link
Author

Choose a reason for hiding this comment

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

@AviadP i change at the new file to - with open('text.txt', 'r') as file

HW python.py Outdated Show resolved Hide resolved
HW python.py Outdated

with open('text.txt') as file:
List=file.read().split()
wordDict={}
Copy link
Contributor

Choose a reason for hiding this comment

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

plz follow python style guide for variable names = this one should be "word_dict", but anyway try to chose better variable names, something that describe the purpose of this var

Copy link
Author

@morbitton morbitton Dec 3, 2019

Choose a reason for hiding this comment

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

@AviadP I renamed it meaningful - word_counter
and in the second problem i renamed to f_read instead of List

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