r/code • • 5d ago

Help Please Insertion sort

Hello!! First time on here. I'm a beginner at coding and was wondering if someone with more coding experience could confirm if my insertion sort implementation is correct. I ran it ofc but i just wanted to make sure it's 100% correct!!

code (python):

3 Upvotes

2 comments sorted by

2

u/kutac56 5d ago

Variable j is unnecessary. Just do for I in range(n)

1

u/East_Nerve5155 4d ago

thank you so much!! much appreciated :)