How to Time Functions in Python using time.time

Publicado el: 31 agosto 2018
en el canal de: Python Marathon
2,280
29

Descargar el Código: patreon.com/pythonmaraton

Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! This video teaches you how to time functions in python. Import time and then you can time how many seconds it takes for something to happen. This has endless applications.

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





TIME FUNCTIONS PYTHON

I will show you how to time functions in python. We are in a text editor and first let me import time

and we will do an if name equal main

First I am going to save a start time as a variable named start.

Now lets write a small function we can time. lets just do an input so we can see how long it take to type

Next let’s save the time again but we will call it end.

and in this print statement if we do end minus start that will give us the time passed.

So let’s run this in the terminal to see what it’s like

and lets type our put

it took 7.5 second.

Lets see if i can time it faster

There you have it that is how you time functions in python

#PythonMarathon #LearnPython #PythonTutorial


En esta página del sitio puede ver el video en línea How to Time Functions in Python using time.time de Duración hora minuto segunda en buena calidad , que subió el usuario Python Marathon 31 agosto 2018, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,280 veces y le gustó 29 a los espectadores. Disfruta viendo!