# To implement stack using list
stackList = []
def nrPush(ele='\0'):
if ele!='\0':
stackList.append(ele)
print("PUSH operation successfully completed.")
else:
print("Operation failled.")
print("Entered element is empty.")
def nrPop():
if(len(stackList)>0):
stackList.remove(stackList[-1])
print("POP operation successfully completed.")
else:
print("Operation failled.")
print("List is empty.")
while(True):
print("\n\nChoose one option : ")
print("1. PUSH operation,")
print("2. POP operation.")
print("3. Display List element.")
print("e. Exit")
op = input()
if op=='1':
ele = input("Enter element for PUSH operation.")
nrPush(ele)
elif op == '2':
nrPop()
elif op == '3':
if(len(stackList)>0):
print(stackList)
else:
print("List is Empty")
elif op == 'e':
break
else:
print("Choose correct option.")
If you have a great ability of thinking, imagination and visualisation than you have to codes your thinking and visualisation.
Friday, 15 June 2018
To implement stack using list using python programming.
Subscribe to:
Post Comments (Atom)
Featured post
In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.
#include #include int main() { char ms; printf("Is Driver married (Y/N): "); scanf("%c",&ms); if(ms=='y...
Popular Posts
-
# Python Program To demonstrate inheritance. # Parent Class class parentCls: def __init__(self): print("Parent Cl...
-
# To implement Queue using list queueList = [] def enQueue(ele='\0'): if ele!='\0': queueList.append(...
-
#Python program to demonstrate constructors # declaration of class class myClass: def __init__(self,fName,lName): # Constructor...
Your article inspired me more and keep writing
ReplyDeletePHP Training in Chennai
web designing course in chennai
JAVA Training in Chennai
Hadoop Training in Chennai
Selenium Training in Chennai
German Classes in chennai
Salesforce Training in Chennai
Salesforce Training in Porur
Thank you
ReplyDeleteI really appreciate the writer and the content are very useful. The explanation way is easily understood to all readers and please updating...
ReplyDeleteOracle Training in Chennai
Oracle course in Chennai
Tableau Training in Chennai
Spark Training in Chennai
Excel Training in Chennai
Primavera Training in Chennai
Pega Training in Chennai
Unix Training in Chennai
Power BI Training in Chennai
Oracle DBA Training in Chennai
experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Find top Salesforce admin interview questions in 2020.
ReplyDeleteThese Salesforce developer interview questions are highly helpful in 2020. You can read these Salesforce lightning interview questions and Salesforce integration interview questions which are prepared by industry experts.
Really it as an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing.
ReplyDeleteWeb Designing Course Training in Chennai | Web Designing Course Training in annanagar | Web Designing Course Training in omr | Web Designing Course Training in porur | Web Designing Course Training in tambaram | Web Designing Course Training in velachery
really a great information in this blog oracle training in chennai
ReplyDelete