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

my Python script #6

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

my Python script #6

wants to merge 1 commit into from

Conversation

noaAisen
Copy link

No description provided.

@@ -0,0 +1,13 @@
file = open("pizza.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.

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")
Copy link
Contributor

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:
Copy link
Contributor

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)
Copy link
Contributor

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

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