← back to unit
Easy
# power tools easy
Any Doubles at All?
The raffle is only fair if no ticket number was printed twice. 🎫
You get the ticket nums. Print all unique if every number is different, or doubles found if any repeats. Hint: what happens to a list's LENGTH when you set() it?
Example:
Input: nums = [5, 8, 2, 9]
Output: all unique
set(nums) keeps all 4 values — same length as nums — so nothing was dropped, meaning nothing repeated.
Input: nums = [4, 7, 4]
Output: doubles found
set(nums) shrinks to {4, 7}, length 2 instead of 3 — something got dropped, so a repeat happened.
💡 need a hint?
pt-any-doubles.py🔒 given lines are locked — write your code in between
loading...