Skip to main content

Stack.peek

Take a look at the element at the top of the stack

Usage

peek()

Returns:
      Boolean
            Returns the element at the top of the stack

Example

from jellybeans.structures import Stackst = Stack()st.push(20)st.push(29)st.push(38)st.push(78)print(st.peek()) # 78print(st) # 78 <- 38 <- 29 <- 20