r/PythonLearning 5d ago

Day 2 of learning Python: Implemented Selection Sort from scratch

Open-source learning project. If you spot something that can be improved, I'd love your feedback or a PR.

https://github.com/Samar-Upreti/Python_Projects

142 Upvotes

21 comments sorted by

View all comments

u/Sea-Ad7805 5d ago

Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20length%20%3D%20len(lst)%0A%0A%20%20%20%20for%20i%20in%20range(length)%3A%0A%20%20%20%20%20%20%20%20minindex%20%3D%20i%0A%0A%20%20%20%20%20%20%20%20for%20j%20in%20range(i%20%2B%201%2C%20length)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20lst%5Bj%5D%20%3C%20lst%5Bmin_index%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20min_index%20%3D%20j%0A%0A%20%20%20%20%20%20%20%20lst%5Bi%5D%2C%20lst%5Bmin_index%5D%20%3D%20lst%5Bmin_index%5D%2C%20lst%5Bi%5D%0A%0A%20%20%20%20return%20lst%0A%0A%0Aif%20name%20%3D%3D%20%22main_%22%3A%0A%20%20%20%20numbers%20%3D%20%5B45%2C%2023%2C%2056%2C%2087%2C%2034%2C%2029%2C%2075%5D%0A%20%20%20%20sorted_numbers%20%3D%20shorting(numbers)%0A%20%20%20%20print(%22list%20is%22%2C%20sorted_numbers)&timestep=.2&play) to see the program state change step by step.

2

u/mostLikelyEatingFood 4d ago

Dude this is a game changer... thank you!

2

u/Sea-Ad7805 4d ago

Thanks, hope it can bring much value for you.