Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSachin Kanchan
564 PointsEXTRA CREDIT after the REFACTOR Challenge
""" Add a "SAVE" option to your script. Use the open function to open a file and save your shopping list to it.
Then use a for loop on the file to read each line in the file. Add each line to your shopping_list variable when your file first runs.
Your list is now more permanent! """
Did anyone do this - EXTRA CREDIT challenge - after Refactor.
https://teamtreehouse.com/library/python-basics
The link that the "open" provides to, I tried reading it. Doesn't make sense to me :|
1 Answer
Jeffrey Duarte
9,706 PointsHi Sachin,
For introductory stages the open() function can be called as
open('file.txt')
The additional arguments that you see in the docs all have defaults and don't have to be adjusted. There is a small chart in the docs that explains what the defaults mean, but for the purpose of the extra credit you only have to pass in the text file you're looking to open.
I hope this helps.
Sachin Kanchan
564 Pointsthanks. you're a life saver. But I still have a long way to go to be able to solve this thing. And where do i complete the EXTRA credit objective. In the refactor itself?
Jeffrey Duarte
9,706 PointsUnfortunately, the extra credit isn't actually extra credit. It's there to help you challenge yourself and for self-growth. You can create it in workspaces and ensure that it runs properly, and ask Kenneth, the staff, or Treehouse community to review your code for feedback.
Sachin Kanchan
564 PointsSachin Kanchan
564 PointsJason Anders Jennifer Nordell