Answers for "list peek python"

1

python list.peek

def peek_list(list):
    if list:
        return list[-1]    # get last element of list
    else:
        return None
Posted by: Guest on March-11-2022
0

list peek python

def peek_stack(stack):
    if stack:
        return stack[-1]    # this will get the last element of stack
    else:
        return None
Posted by: Guest on April-12-2022

Python Answers by Framework

Browse Popular Code Answers by Language