The important thing is your code works. Well done! I solved this differently than you did, but your way is just as valid.
At this point, in my opinion, it’s fine to just be happy with solving the algorithm. It can be useful to come back to the basic algorithms and redo them in a few weeks, or a month. Refactoring your code on your own after learning more is great practice.
Oh, by the way, you should probably use the spoiler function when posting full solutions. They don’t like too many solutions for the challenges in the forum.
This would be a good candidate for a ternary expression.
This challenge can be solved without sorting first. Think about an algorithm to do that. I will give you a hint:
If you iterate through the array and find that no other number is smaller than num, then you know you would insert num at the beginning of the array (index 0).
If you iterate through the array and find that only one of the elements is smaller than num, then you know you would insert num as the second element (index 1).
If you iterate through the array and fine that two elements are smaller than num, you know you would insert num as the third element (index 2).