15 Python tips and tricks, so you don’t have to look them up on Stack Overflow

Image for post
Image for post

Tired of searching on Stack Overflow every time you forget how to do something in Python? Me too!

Here are 15 python tips and tricks to help you code faster!

(1) Swapping values

(2) Combining a list of strings into a single one

(3) Splitting a string into a list of substrings

(4) Initialising a list filled with some number

(5) Merging dictionaries

(6) Reversing a string

(7) Returning multiple values from a function

(8) List comprehension

(9) Iterating over a dictionary

(10) Iterating over list values while getting the index too

(11) Initialising empty containers

(12) Removing useless characters on the end of your string

(13) Find the most frequent element in a list

(14) Check the memory usage of an object

(15) Convert a dict to XML

Like to learn?

Follow me on twitter where I post all about the latest and greatest AI, Technology, and Science! Connect with me on LinkedIn too!

Recommended Reading

Want to learn more about coding in Python? The Python Crash Coursebook is the best resource out there for learning how to code in Python!

And just a heads up, I support this blog with Amazon affiliate links to great books, because sharing great books helps everyone! As an Amazon Associate I earn from qualifying purchases.

Written by

Certified Nerd

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store