β back to unit
Challenge
# searching advanced
The First Repeated Card
You flip cards one by one β the game ends the first time you flip a card you've already seen. π΄
You get a list of cards (a repeat is guaranteed). Print the first card that appears for the second time.
Example:
Input: cards = ["sun", "moon", "star", "moon", "sun"]
Output: moon
"sun", "moon", and "star" are all new the first time. The second "moon" is the first card seen a second time.
π‘ need a hint?
srch-first-repeated-card.pyπ given lines are locked β write your code in between
loading...