python calculate time taken
import time
start = time.process_time()
# your code here
print(time.process_time() - start)
python calculate time taken
import time
start = time.process_time()
# your code here
print(time.process_time() - start)
python how to measure code run in time
import time
start_time = time.time()
main()
print("--- %s seconds ---" % (time.time() - start_time))
how to check runtime of program in python idle
def chk():
n=int(input("enterthe number to check if the number is a multiple of 2"))
c=1
f=0
for i in range(0,n,1):
if(c==n):
print("the number is power of two ")
f=1
break
else:
c=c*2
if(f<1):
print("the number is not a multiple of 2")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us