How to Time Functions in Python using time.time

Publicado em: 31 Agosto 2018
no 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


Nesta página do site você pode assistir ao vídeo on-line How to Time Functions in Python using time.time duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Python Marathon 31 Agosto 2018, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,280 vezes e gostou 29 espectadores. Boa visualização!