Program - function to show namedtuple is instance of tuple


Topic: Program - function to show namedtuple is instance of tuple

Solution

def show_ins_tup():
    from collections import namedtuple
    IplData = namedtuple('IplData', 'match toss choice session1 session2 winner')
    match1 = IplData('RCBvsKKR', 'KKR', 'bat', '229/9', '85/8', 'KKR')
    return isinstance(match1, tuple)



List all Python Programs