1-June
1-June
# Assignment
# WAP to implement "STACK" using list
# PUSH ( Add new ele at the end ) : append()
# POP ( remove last ele ) : pop()
# Stack = [10,20,30,40,50,60,70]
stack = [] # EMpty List
while True : # infinite loop
print(" 1 PUSH ")
print(" 2 POP ")
print(" 3 SHOW ")
print(" 0 Exit ")
print(" Enter Your Choice ")
ch = int(input()) # 1
if ch == 1:
#------ # append()
#------
elif ch == 2: # pop()
#-------
#-------
elif ch == 3:
#------- # reverse list ( slicing )
#-------
elif ch == 0:
break
else:
print("Invalid Choice ")
'''
'''
# Aliasing and Cloning of List objects
# '+' operator
L1
[10, 3333, 'Hello', 78.29]
L2
[10, 4444, 'Hello', 78.29]
L3 = L1 + L2
L3
[10, 3333, 'Hello', 78.29, 10, 4444, 'Hello', 78.29]
L3 = [1,2,3] + [11,22,33,44,55]
L3
[1, 2, 3, 11, 22, 33, 44, 55]
L3 = [1,2,3] + "Hello" # Error
# Membership operators
# 'in' and 'not in' operator ( Check element in SEQUENCE )
77 in L1
False
4 in L1
True
77 not in L1
True
44 in L1
False
L1 = [1,2,3,4]
L1.clear() # make empty L1 object
L1
[]
id(L1)
2306342174208
del L1
L1
# Error undefined 'L1'