Sunday, July 7, 2019

Number of seconds to respond

Script

#!/usr/local/bin/python3

from time import perf_counter

print()
print("Enter your name: ", end = '')

start_time = perf_counter()
yourname = input()

elapsed = perf_counter() - start_time

print(yourname, ", it took you", elapsed, " number of seconds to respond.")
print()


Execution

Enter your name: Kiran
Kiran , it took you 3.7272777440000002  number of seconds to respond.


Enter your name: Kiran
Kiran , it took you 14.259462822  number of seconds to respond.






No comments:

Post a Comment