r/PythonLearning 20h 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

82 Upvotes

13 comments sorted by

u/Sea-Ad7805 14h 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.

9

u/burnt-store-studio 20h ago

On day two! Good for you! Python programming is such fun; I hope you have a great journey with the language!

1

u/Firered_Productions 3h ago

Tbf compared to what this posted for day n one this is realistic. Maybe this is day 7 for me the other V one is year 4 for me

0

u/Samar__Upreti 20h ago

Thanks Buddy

2

u/AdDiligent1688 20h ago edited 20h ago

Nice! Now try a bogo sort! Then bozo sort!

2

u/FreeLogicGate 6h ago

Word of advice: stop posting pictures of your code, and start posting the code in a code block. Then people can provide you feedback and comments.

4

u/Ashamed_Training_702 20h ago

Yall be killing me with these milestones 😂 3rd day: I built an international banking system

-4

u/Samar__Upreti 20h ago

Actually the correct caption should be Day 2 of posting on reddit 😂 It's around 20 day of learning python

0

u/yahddyyp 10h ago

stop using vscode start using something nvim as you can say i use vim btw and it wont hurt you since almost every text editor supports vim keys

2

u/ThatOtherBatman 8h ago

Do yourself a favour, and don’t use `list` as variable name. It’ll only end in tears.

1

u/AuMouhssin 7h ago

This is just huge progress rate I advice you not to take a lot of tome with static algorithms, move two dynamic data structures and algorithms

1

u/BakedFish---SK 2h ago

Try writing linux kernel next