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 trial

Computer Science Algorithms: Sorting and Searching Sorting Algorithms Bogosort

You'll need a load.py file saved in the same directory as the bogosort.py file, with the following contents.

I am using work space as python idle.Can somebody help me how to load save file from same directory?

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

You can see the details in the load.py file available in the download tab below the video.

If you wish a basic alternative you can try:

with open(β€œfilename_here”) as f:
    # create list of all lines in file
    data = f.readlines()

# convert to integers from strings
data = [int(x) for x in data]

Post back if you need more help. Good luck!!!

Matthew McQuain
Matthew McQuain
14,184 Points

But there are no project files to download in the first two videos? Do they add them later, or do I need to copy-paste everything to my own editor?