Share your repls and programming experiences

← Back to all posts
merge sort one liner!! (1 line series)[no2]
rafrafraf (1396)

After making bogo sort in one line (and before attempting the hangman game in one line) i decided to challenge myself further by making merge sort in one line.

This was no easy task, not only is it difficult enough to use nested list comprehension, the hardest part was going about the while loop,

since merge sort is (typically) done using while loops and since you cannot use while loops inline.. i had to create a recursive function within a function as well as multiple if statements and list comprehension, ALL in one line!

although this proved to be much more challenging than inline bogosort, i actually didnt struggle as much with this from all the inline coding practise that bogo sort monstrosity gave me


angrydoge (465)
ValueError: invalid literal for int() with base 10: '31 90 1 09'
JBloves27 (1729)

hahaha, amazing! Keep it up! XD

rafrafraf (1396)

@JBYT27 thanks man! if you (or anyone else) get an idea for something i should make in one line let me know!

JBloves27 (1729)

np! Sure, i will! @rafrafraf

actually, maybe try doing the number game?