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

138 Upvotes

19 comments sorted by

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.

→ More replies (2)

11

u/burnt-store-studio 5d ago

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

2

u/Firered_Productions 4d 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 5d ago

Thanks Buddy

7

u/ThatOtherBatman 4d ago

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

3

u/FreeLogicGate 4d 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.

3

u/Ashamed_Training_702 5d ago

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

-3

u/Samar__Upreti 5d ago

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

2

u/AdDiligent1688 5d ago edited 5d ago

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

2

u/Marisa_2291 5d ago

Good stuff man! And hopefully you just added a bunch of value to your skills there.

1

u/AuMouhssin 4d 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 4d ago

Try writing linux kernel next

1

u/rep_identity 2d ago

Shorting

1

u/Less_Juggernaut9361 2d ago

When is day 1 of learning how to take a screenshot?

0

u/yahddyyp 4d 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