Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- devices = ["iphone", "android", "radio", "tv", "tablet", "pc", "laptop"]
- user_input = input("Enter a device name: ").strip().lower()
- start_time = time.time()
- is_present = user_input in devices
- end_time = time.time()
- if is_present:
- print(f"'{user_input}' is in the device list.")
- else:
- print(f"'{user_input}' is NOT in the device list.")
- print(f"Time taken for the check: {end_time - start_time:.10f} seconds")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement