-
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
my Python script #6
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,13 @@ | |||
file = open("pizza.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.
When opening file it is mandatory to close it when its no longer needed. you can use "close" method, but better implementation would be to use "with...open"
@@ -0,0 +1,13 @@ | |||
file = open("pizza.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.
It is Better using full file path
data = file.read().split() | ||
print(data) | ||
dict={} | ||
for i in data: |
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 names should be clear and meaningful. in python it is not common to use 'i' as index var
@@ -0,0 +1,13 @@ | |||
file = open("pizza.txt", "r") | |||
data = file.read().split() | |||
print(data) |
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.
This output may be useful for debugging, but not required as challenge results
No description provided.