''' ................................................... CP164 - Data Structures Author: Laith Adi ID: 170265190 Email: [email protected] Updated: 2019-01-31 ................................................... ''' from Stack_array import Stack from utilities import array_to_stack #grab the stack from user source = Stack() l = input("Enter items (separate by space bar): ").split(" ") array_to_stack(source, l) #print the orginal print("Original:") for i in source: print(i, end = " ") print() #print the reverse stack print("Reverse:") source.reverse() for i in source: print(i, end = " ")
------------------------------------------------------------------------ [program description] ------------------------------------------------------------------------ Author: Nicolas Mills ID: 180856100 Email: [email protected] __updated__ = 2019-02-13 ------------------------------------------------------------------------ """ from Stack_array import Stack vals = [1,2,3,4] s = Stack() for val in vals: s.push(val) for i in s: print(i, end=',') print() s.reverse() for i in s: print(i, end=',') print() s.reverse() #1,2,3,4 target1, target2 = s.split_alt() for i in target1: print(i, end=',') print() for i in target2: print(i, end=',') print()