December 20, 2022
Estimated Post Reading Time ~

10 python one-liners everyone should know

10 python one-liners everyone should know

1. Anagram


2. Binary to decimal



3. Converting string to lower case



4. Converting string to upper case



5. Converting string to byte


6. Copy files


7. Quicksort 
qsort = lambda l : l if len(l)<=1 else qsort([x for x in l[1:] if x < l[0]]) + [l[0]] + qsort([x for x in l[1:] if x >= l[0]])

8. Sum of n consecutive numbers


9. Swap two values


10. Factorial of a number





By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.