Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
from collections import namedtuple Card = namedtuple("Card", ["rank", "suit"]) hand = [Card("A", "spades"), Card("K", "hearts"), Card("10", "clubs")] for card in hand: print(f"{card.rank} of {card.suit}") print(hand[0]._asdict())
Result
Open