7 Must-Know Tricks In Becoming a Pro in Python

Abideen Bello
Analytics Vidhya
Published in
4 min readDec 15, 2020

--

Photo by Rythik on Unsplash

Python is an exceptionally flexible programming language, it has a syntax that is easy to understand and it takes far less time to learn than many other languages out there.

Given this even very advanced creators of python scripts, do not know basic tips and tricks that can often be very helpful. Here’s a list that you need to know of neat tips and tricks.

1. Time Tracking

Photo by Lukas Blazek on Unsplash

Python script can often run slowly, and it can be very hard to tell what part of the code causes the problem, to fix this, by using this code fragment, you may look at the time taken by certain sections of the code:

# Import time libraryimport time# Start timestart_time = time.time()# The main function to perform some calculationdef main():return list(i%2 for i in range(31))# call the fubctionif __name__ == “__main__”:main()# the time the functin finished execution

--

--

Abideen Bello
Analytics Vidhya

I’m an IBM Certified Data Scientist with knowledge of Machine learning application, Data Visualization Expertise, and vast knowledge of Tableau, Power BI, etc.