Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import timeit
- diyan_code = """
- numbers = "1 2 3 4 5".split(" ")
- [print(numbers.pop(), end=" ") for _ in range(len(numbers))]
- """
- atanas_code = """
- numbers = "1 2 3 4 5".split(" ")
- my_stack = []
- while numbers:
- my_stack.append(numbers.pop())
- print(" ".join(my_stack))
- """
- execution_time = timeit.timeit(diyan_code, number=1)
- print(f"Diyan - Execution time: {execution_time:.6f} seconds")
- execution_time = timeit.timeit(atanas_code, number=1)
- print(f"Atanas - Execution time: {execution_time:.6f} seconds")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement