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
Code Example |
---|
:: |
Python :: upload file setup django url |
:: changes in settings.py for media storage without db |
Python :: how to split a string by space in python |
:: declaring list size python |
:: len dictionary python |
:: |
:: mean squared error in machine learning formula |
:: |
:: |
Python :: replace in python |
:: |
:: |
Python :: |
Python :: |
:: |
Python :: |
:: how to define a dictionary in python |
:: python remove |
:: length of an empty array in python |
Python :: |
:: |
:: |
Python :: |
Python :: |
Python :: |
:: deque python |
Python :: |
:: |
Python :: help() python |