Python List.Peek
def peek_list(list):
if list:
return list[-1] # get last element of list
else:
return None
Wissam
def peek_list(list):
if list:
return list[-1] # get last element of list
else:
return None
def peek_stack(stack):
if stack:
return stack[-1] # this will get the last element of stack
else:
return None