In this video, I show 11 Tips and Tricks to Write Better Python code! I show a lot of best practices that improve your code by making your code much cleaner and more Pythonic.
Find Python jobs: pythonengineer.pallet.com
~~~~~~~~~~~~~~ GREAT PLUGINS FOR YOUR CODE EDITOR ~~~~~~~~~~~~~~
✅ Write cleaner code with Sourcery: sourcery.ai/?utm_source=youtube&utm_campaign=pythonengineer *
📚 Get my FREE NumPy Handbook:
python-engineer.com/numpybook
📓 Notebooks available on Patreon:
patreon.com/patrickloeber
⭐ Join Our Discord : discord.gg/FHMg9tKFSN
If you enjoyed this video, please subscribe to the channel!
All Tips:
1) Iterate with enumerate instead or range(len(x))
2) Use list comprehension instead of raw for loops
3) Sort complex iterables with sorted()
4) Store unique values with Sets
5) Save memory with Generators
6) Define default values in Dictionaries with .get() and .setdefault()
7) Count hashable objects with collections.Counter
8) Format strings with f-Strings (Python 3.6+)
9) Concatenate strings with .join()
10) Merge dictionaries with {**d1, **d2} (Python 3.5+)
11) Simplify if-statements with if x in list
List comprehension Tutorial: youtu.be/RaIu2-NM0t0
~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
🖥️ Website: python-engineer.com
🐦 Twitter - twitter.com/patloeber
✉️ Newsletter - python-engineer.com/newsletter
📸 Instagram - instagram.com/patloeber
🦾 Discord: discord.gg/FHMg9tKFSN
▶️ Subscribe: youtube.com/channel/UCbXgNpp0jedKWcQiULLbDTA?sub_confirmation=1
~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
🅿 Patreon - patreon.com/patrickloeber
Music: bensound.com/
# Python #Tips
----------------------------------------------------------------------------------------------------------
* This is a sponsored or an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏
- 11 Tips And Tricks To Write Better Python Code ( Download)
- Top 5 Tips and Tricks to Write Better Python Code! ( Download)
- 25 nooby Python habits you need to ditch ( Download)
- 10 ULTIMATE Python Tips 🔥 ( Download)
- 8 Python Coding Tips - From The Google Python Style Guide ( Download)
- Tips and Tricks for Writing Reliable Python Code ( Download)
- 7 More Tricks to Write Better Python Code ( Download)
- 9 Simple Tips For Writing Better Code in Python ( Download)
- THIS Python Trick Seriously CHANGED My Life ( Download)
- Best Python Practices | Tips & Tricks for Writing Better Python Programs | Python Training | Edureka ( Download)
- THIS Python Tip Will Make Your Code MORE Professional ( Download)
- How To OPTIMIZE Your Code!! #python #programming #coding ( Download)
- Make Your Python Code More Professional ( Download)
- 99% Of Python Programmers Never Learned THIS Feature ( Download)
- Top 10 Python Tips and Tricks For Writing Better Code ( Download)