Projects/pop_list.py

13 lines
374 B
Python

from typing import List, Tuple
Card = Tuple[str, str] # ('Rank', 'Suit')
Hand = List[Card]
def pop_list(lst: List, index: int) -> Tuple:
"""Removes and returns the element at the specified index from the list."""
if index < 0 or index >= len(lst):
raise IndexError("Index out of range")
element = lst[index]
lst.remove(element)
return element