Advertisement
horozov86

devices

Sep 14th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import time
  2.  
  3. devices_collection = {"iphone", "android", "radio", "tv", "tablet", "pc", "laptop"}
  4.  
  5. device_name = input("Enter the device name: ")
  6.  
  7. start_time = time.perf_counter()
  8.  
  9. result = f"{device_name} is in the list." if device_name in devices_collection else f"{device_name} is not in the list."
  10.  
  11. end_time = time.perf_counter()
  12.  
  13. time_taken = end_time - start_time
  14.  
  15. print(result)
  16. print(f"Time taken: {time_taken:.6f} seconds")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement