Namaste Harsh sir. Mein abhi abhi scl se half yearly exams deke aa rha hu. Aapke python ke videos mein last 3 days se follow kar rha hu aur sir aaj sahi mein exam hall mein paper deke khushi hua. Thank you sir. Aapke lectures bahut helpful hai. Kam time mein best way hai ye series python sikhne ke liye.
stack = [] def push(stk, item): stk.append(item) def pop(stk): if not stk: return 'Underflow!' return stk.pop() def peek(stk): if not stk: return 'Underflow!' return stk[-1] def display(stk): if not stk: print('Stack is empty!') else: print('Top of the stack: ', stk[-1]) print('Stack elements:') for item in reversed(stk): print(item) while True: choice = input('''STACK IMPLEMENTATION 1. PUSH 2. POP 3. PEEK 4. DISPLAY 5. EXIT Enter your choice (1-5): ''')
if choice == '1': item = int(input("Enter the item you want to push: ")) push(stack, item) print(item,' added successfully')
elif choice == '2': item = pop(stack) if item == 'Underflow!': print('Stack is empty') else: print(item,' popped from the stack')
elif choice == '3': item = peek(stack) if item == 'Underflow!': print('Stack is empty') else: print('%d is at the top of the stack' % item)
def Push(stk,item): stk.append(item) print("Item is added successfully to the stack") def Pop(stk): if stk==[]: print("Stack is already Empty") else: stk.pop() def Display(stk): a=stk[::-1] print(a) stk=[] while True:
print("1.Push 2.Pop 3.Display") ch=int(input("Enter Your Choice:::")) if ch==1: no.=int(input("Enter no. to be added:::")) Push(stk,no.) if ch==2: Pop(stk) if ch==3: Display(stk)
@@subasit122Tu dekhta hoga 2x pe hmlog nhi jo chiz pehle padh liye hai usko 2x me dekha jata hai per ye aaj padh reha hai or ye channel khud 2x me video bhaga reha hai
basically top gives us the index of the most recent element in stack and the indexing in list starts from 0 onwards, so top= len(stk)-1. Eg: L=[a,b,c,d] the len(L)=4 but index of d is 3. Hope this helps!
Hatts of to harsh bhaiya,aman bhaiya and all bhaiyas and Didi's😊😊😊 for making a pure and awesome content. You would always be remembered. Respect man!!!! Respect$$$😌
This is the most code intensive lecture.......thanks bhaiya😊😊😊😊 and pls everyone like share its dissapointing that likes are decreasing video by video.....😐😐😐😐
Bro your code means stack implementation program contains under 77 line program Even I have a also program under 25 to 40 lines like stack implementation and my program was too easy and understandable!!!
This is the right code if you are having problem with pop :) --------------------------Code------------------------------------- s=[] top=None def isEmpty(stk): if stk==[]: return True else: return False def push(stk,item): s.append(item) top=len(stk)-1 def spop(stk): if(isEmpty(stk)): return('UnderFlow!') else: i = stk.pop() if(len(stk) ==0): top=None else: top=-1 return i def peek(stk): if isEmpty(stk): return('underflow') else: top=len(stk)-1 return(stk[top]) def display(stk): if(isEmpty(stk)): print('Stack is empty!') else: top=len(stk)-1 print(stk[top],'
Teacher : You don't attend my class; still you're scoring 90+ in every CS paper; what's the secret? Me : Sir, have you heard of Harsh Sharma of Apni Kaksha? Teacher : 😑😑
Si aapki theme sabse alag can please tell us about that also yeh jo identaion ki lining show krta hai iske baare main bhi basicaaly aap apne pure python ki setting bta do ek baar Please
Bhaiya please 🙏🙏🎉 Jaise hi 2 Feb ko dates announce hogi CBSE ki, 12 pcm ke liye full 3 months detailed strategy bana dena subject wise please🙏🙏🙏 Please bhaiya 🙏🙏🙏👍👍👍 Much needed🙏🙏 Huge request 🙏🙏 Please think on it🙏🙏 Don't ignore 🙏🙏🙏
heres a simpler and far better code, stack = [] def push(stk, item): stk.append(item) def pop(stk): if not stk: return 'Underflow!' return stk.pop() def peek(stk): if not stk: return 'Underflow!' return stk[-1] def display(stk): if not stk: print('Stack is empty!') else: print('Top of the stack: ', stk[-1]) print('Stack elements:') for item in reversed(stk): print(item) while True: choice = input('''STACK IMPLEMENTATION 1. PUSH 2. POP 3. PEEK 4. DISPLAY 5. EXIT Enter your choice (1-5): ''')
if choice == '1': item = int(input("Enter the item you want to push: ")) push(stack, item) print(item,' added successfully')
elif choice == '2': item = pop(stack) if item == 'Underflow!': print('Stack is empty') else: print(item,' popped from the stack')
elif choice == '3': item = peek(stack) if item == 'Underflow!': print('Stack is empty') else: print('%d is at the top of the stack' % item)
Namaste Harsh sir.
Mein abhi abhi scl se half yearly exams deke aa rha hu.
Aapke python ke videos mein last 3 days se follow kar rha hu aur sir aaj sahi mein exam hall mein paper deke khushi hua.
Thank you sir.
Aapke lectures bahut helpful hai.
Kam time mein best way hai ye series python sikhne ke liye.
CODE:
s=[]
top=None
def isEmpty(stk):
if stk==[]:
return True
else:
return False
def push(stk,item):
s.append(item)
top=len(stk)-1
def spop(stk):
if(isEmpty(stk)):
return('UnderFlow!')
else:
i = stk.pop()
if(len(stk) ==0):
top=None
else:
top=top-1
return i
def peek(stk):
if isEmpty(stk):
return('underflow')
else:
top=len(stk)-1
return(stk[top])
def display(stk):
if(isEmpty(stk)):
print('Stack is empty!')
else:
top=len(stk)-1
print(stk[top],'
king
king
king
King ?
@@Abhinav-gu2ui king
best of luck everyone jiska bhi subah exam hai
Are you ready ?
@@letsamaze7072 nha bro
No bro
All the best to all for today's exam
kis kis ka exam kl hai???
Bhai dimg sahi hai ?sabka kal he hoga
lol mera bhi hai kl,
good luck aapko bhi 👍
Samjh ni aara kuch🤧🤧
@@24ragerude
Aaj h😅
All the best for your 29 March 2025 exam❤
11:25 the most epic part🤣🤣🤣
😂 Seriously...
pls post notes for this video notes are the best parts of the series
Abbe Yeh code h Iske koi notes thodi hain lmao
All the best for you 2 april 2024 Exam ❤
Best in the world "Aman dhattarwal" zabardast.
Thanks a lot :)))
Love to the apni kaksha team
5:15 sir but agar hame shrif peek karna hai to ham direct -1 index bhi to print kara sakate hai wo bhi to top he hai
stack = []
def push(stk, item):
stk.append(item)
def pop(stk):
if not stk:
return 'Underflow!'
return stk.pop()
def peek(stk):
if not stk:
return 'Underflow!'
return stk[-1]
def display(stk):
if not stk:
print('Stack is empty!')
else:
print('Top of the stack: ', stk[-1])
print('Stack elements:')
for item in reversed(stk):
print(item)
while True:
choice = input('''STACK IMPLEMENTATION
1. PUSH
2. POP
3. PEEK
4. DISPLAY
5. EXIT
Enter your choice (1-5): ''')
if choice == '1':
item = int(input("Enter the item you want to push: "))
push(stack, item)
print(item,' added successfully')
elif choice == '2':
item = pop(stack)
if item == 'Underflow!':
print('Stack is empty')
else:
print(item,' popped from the stack')
elif choice == '3':
item = peek(stack)
if item == 'Underflow!':
print('Stack is empty')
else:
print('%d is at the top of the stack' % item)
elif choice == '4':
display(stack)
elif choice == '5':
break
else:
print('Invalid input')
print('
')
NOTES UPLOAD KAR DO BHAIYA!!!!!
PRACTICALS AND PRE BOARDS H
Aman bhaiya zindabad....🙏🙏🙏
def Push(stk,item):
stk.append(item)
print("Item is added successfully to the stack")
def Pop(stk):
if stk==[]:
print("Stack is already Empty")
else:
stk.pop()
def Display(stk):
a=stk[::-1]
print(a)
stk=[]
while True:
print("1.Push
2.Pop
3.Display")
ch=int(input("Enter Your Choice:::"))
if ch==1:
no.=int(input("Enter no. to be added:::"))
Push(stk,no.)
if ch==2:
Pop(stk)
if ch==3:
Display(stk)
Thodan jyada he 'if' use kar diya . All the best for cs exam.
@@Rbrnrntbetntybet elif hoga right?
@@MadMax-fs3cy
Haa
If ch==1 ke baad elif= 2, 3,4...etc hoga
@@MadMax-fs3cy else bhi hoga last me
if -elif - else
Item is not defined
itna bhagaate kyu ho yaar saare videos me
ya
Nahi bhagane par phir tum log 2x pe dekhto ho isiliye
@@subasit122Tu dekhta hoga 2x pe hmlog nhi jo chiz pehle padh liye hai usko 2x me dekha jata hai per ye aaj padh reha hai or ye channel khud 2x me video bhaga reha hai
4 saal purani hai video 😑@@amanguptan
12:30 most epic
i tried writing the code :D
s = []
top = None
def isEmpty(stk):
if stk==[]:
return True
else:
return False
def push(stk,item):
stk.append(item)
def pop(stk):
if(isEmpty(stk)):
return('UnderFlow')
else:
i = stk.pop()
return i
def peek(stk):
if isEmpty(stk):
return('underflow')
else:
return(stk[len(stk)-1])
def display(stk):
if(isEmpty(stk)):
print('Stack is empty!')
else:
top=len(stk)-1
print(stk[top],'
are ch==5 k niche break dene se kay kisika error dikah raha h?? error- break outside the loop
11:23 🤣🤣🤣🤣
Thank you so much Aman Bhaiya and Team 🙏🏻
THE CORRECT CODE
s=[]
top=None
def isEmpty(stk):
if stk==[]:
return True
else:
return False
def push(stk,item):
s.append(item)
top=len(stk)-1
def spop(stk):
if(isEmpty(stk)):
return('underflow')
else:
i = stk.pop()
return i
if(len(stk) ==0):
top=None
else:
top=top-1
def peek(stk):
if isEmpty(stk):
return('underflow')
else:
top=len(stk)-1
return(stk[top])
def display(stk):
if(isEmpty(stk)):
print('Stack is empty!')
else:
top=len(stk)-1
print(stk[top],'
What does %d and %item mean?
@@adityabhandari6145 check out 8:45 you will get it
@@viee488 yes but what does it mean?
Why we are writing top = len(stk)-1
why not top = len(stk) only
basically top gives us the index of the most recent element in stack and the indexing in list starts from 0 onwards, so top= len(stk)-1. Eg: L=[a,b,c,d] the len(L)=4 but index of d is 3. Hope this helps!
Hatts of to harsh bhaiya,aman bhaiya and all bhaiyas and Didi's😊😊😊 for making a pure and awesome content. You would always be remembered.
Respect man!!!! Respect$$$😌
Me : writing andhe 1.... 5dalna tha in my pre board if I've to write menu driven program for stack
My marks : Rip💔🙂
Andhe galat ch padh liya term 1 me nhi tha 😂
@@parveenparveen4565 most probably case based question or a sample code edit problems
Thankyou bhaiya!!☺️☺️☺️
how can this code be used for string value
Can anyone explain to me what this %d and %item is for?
Thnx sir😊😊
thank you for such great lecture harsh sir you teach really well
Thanks
Sir pls phy ka second books ka notes dedijiye mra preboards hai
What 'bout my notes?🙈
Take it easy 😂👍
Description mai code Kaha hain
bhaiya huge huge huge request to u pls upload aldehyde ,ketones notes 🙏🙏🙏🙏🙏🙏🙏🙏
Eat well, Sleep well and study well...🙂
what is the use of %d here?
just a future reference operator ..
Thank u sooo muchh bhaiyaaa
Stay blessed
सी please लॉन्च cs series for tomorrow board paper
One day before exam. Willl. Like 😂 👍
Why did we take S=[ ] , when we didn't use it anywhere in the code??
bro here S acts as stk for the rest of the program
Sir notes ka link daal do
Sir please provide the link of the code 🙏🙏
Can anyone please tell me where we can find new notes of wave optics by Aman bhaiya?
Discod server☺
@@munmun2830 kon sa?
Sir,
IP walo ka lia plz... Pythan or my SQL ka corse dalo plz...
🙏🙏🙏🙏🙏
I who also want...
Sir
Syllabus kab complete hoga??
Sir ' global ' variable should be used in every function definition for top. without it, it is showing error
can someone tell what's the text editor or software he's using?
Vs text editor
@@shreeyansh-x5l thanks man
Bhaiya yaha error dikha raha hai... It's telling that "local variable refrencedy before assignment"
kindly see my comment and it's reply in the comment section
Please share it's notes
Bhaiya wave optics ke notes aur semiconductor ke notes Bhi Daal dijiye aap RUclips par ....🙏
Wave optics already uploaded on discord
Bhai top ki value len-1 kaise h?
top kyuki top element alag se treat kiya gaya hai
ussko special mention kiya hai
great video bro
i laughed when the first output come, at the very first time
This is the most code intensive lecture.......thanks bhaiya😊😊😊😊 and pls everyone like share its dissapointing that likes are decreasing video by video.....😐😐😐😐
link to the notes not given
Bhaiya aapki Alternating current wali video ka 1st lecture chal Nhi rha h Baaki sare Chl rhe h Unacadmey app pr kuch Kro bhaiya plz plz..
Bro your code means stack implementation program contains under 77 line program
Even I have a also program under 25 to 40 lines like stack implementation and my program was too easy and understandable!!!
Hey dude can u send ur Program here.
@@Patelnchora69 I am outside from home!!
@@angadprajapati2854 oh.
Bro have u reached home?@@angadprajapati2854
sir plsss give discord link jo description main thi wo wali expire ho gyi
This is the right code if you are having problem with pop :)
--------------------------Code-------------------------------------
s=[]
top=None
def isEmpty(stk):
if stk==[]:
return True
else:
return False
def push(stk,item):
s.append(item)
top=len(stk)-1
def spop(stk):
if(isEmpty(stk)):
return('UnderFlow!')
else:
i = stk.pop()
if(len(stk) ==0):
top=None
else:
top=-1
return i
def peek(stk):
if isEmpty(stk):
return('underflow')
else:
top=len(stk)-1
return(stk[top])
def display(stk):
if(isEmpty(stk)):
print('Stack is empty!')
else:
top=len(stk)-1
print(stk[top],'
Thanks bro!
@@keer-3 iss saal stack implimentation tk he ayega na?
application of stack cut ho gya?
kya
me sochra tha sab to sahi kr rha hu galat kaise aa rha h, def spop try kr k dekhta hu
Thnsksss
Sir pehle h
jinka video slow krk dekhna pad rha h
Kon kon aj subah dekh rha(2 April)😂
14:09 wahi to nhi hai 😐🙃
Aman bhaiya please assembly language programing bhi karo na
Sir vector chapter ka vedio banaiye
How to get this code file?
diy
Sir kya MySQL ki bhi classes hongi?
videos available kindly check
Yeh to bahut lamba program haii....
Exam m stack queue se related kaise questiom ayenge???
Where is not of this lecture
Dosto ye %d kya h?
10 bjne wale hain aur mein pop top par rha... 🫠
Teacher : You don't attend my class; still you're scoring 90+ in every CS paper; what's the secret?
Me : Sir, have you heard of Harsh Sharma of Apni Kaksha?
Teacher : 😑😑
Lol
@@harshsharma4197 😂
Where are the notes of this lecture???....not there in the description box
Bhaiya yae kya boards kae exam mae aata hai....practicals mae...plz koyi bataoo
Ye konse applicatⁿ pe code likha or run kraya??
pop is not working man even if i have changed the function name
Bhaiya code kaha hai description box me
code nhi mil rha hai, aur muje error aa rha hai
@@ehtishama3066 main de du kya code?
@@arpita6479 yes bro, please share link
awesome!
bhaiya IP vaalo ke liye bhi krdo kuch plz 🙏🙏🙏🙏
Bhaiya hadd se jyaada ad daalte hai 💀
Re-upload old videos of C++ for Class 12
Bhaiya Konsa version use karte ho python ka
thank u
Which software is this ?
bro hamari teacher ne hamse sign karva liye ki 60 % stack me nahi ay to 1week ke liye suspension.
mtlb?
Notes kaha hai???
Si aapki theme sabse alag can please tell us about that also yeh jo identaion ki lining show krta hai iske baare main bhi basicaaly aap apne pure python ki setting bta do ek baar Please
use ide provided by jetbrains
Please upload notes of this lecture
Sir es playlist ke poore notes toh upload kr dete..
How many marks to pass in computer science in theory please reply
23.5
24
Bhai 20 ka kardega to 4 extra badha dete hai 🎉
Maza AYA !!!!
Sach h na
Bhaiya please 🙏🙏🎉
Jaise hi 2 Feb ko dates announce hogi CBSE ki, 12 pcm ke liye full 3 months detailed strategy bana dena subject wise please🙏🙏🙏
Please bhaiya 🙏🙏🙏👍👍👍
Much needed🙏🙏
Huge request 🙏🙏
Please think on it🙏🙏
Don't ignore 🙏🙏🙏
7:20
Sir plz jaldi jaldi cs python ka pura syllabus kar va dijiye for baords
As we are having our pre boards in February
which python software u r use?
vs text editor
Kis application pe code krte ho bta do please
Vs code
khaa hai code ka link
Ye )practical me aa skta hai?
11:25 bro fr harrassing user💀💀💀💀
Yahan %d kya hai??
Bhaiya is code ka description pai dal do link
heres a simpler and far better code,
stack = []
def push(stk, item):
stk.append(item)
def pop(stk):
if not stk:
return 'Underflow!'
return stk.pop()
def peek(stk):
if not stk:
return 'Underflow!'
return stk[-1]
def display(stk):
if not stk:
print('Stack is empty!')
else:
print('Top of the stack: ', stk[-1])
print('Stack elements:')
for item in reversed(stk):
print(item)
while True:
choice = input('''STACK IMPLEMENTATION
1. PUSH
2. POP
3. PEEK
4. DISPLAY
5. EXIT
Enter your choice (1-5): ''')
if choice == '1':
item = int(input("Enter the item you want to push: "))
push(stack, item)
print(item,' added successfully')
elif choice == '2':
item = pop(stack)
if item == 'Underflow!':
print('Stack is empty')
else:
print(item,' popped from the stack')
elif choice == '3':
item = peek(stack)
if item == 'Underflow!':
print('Stack is empty')
else:
print('%d is at the top of the stack' % item)
elif choice == '4':
display(stack)
elif choice == '5':
break
else:
print('Invalid input')
print('
')
Bruuuh...ye yad kese hoga😂
does it is correct code !?
Notes to upload kar do itne din se bol raha hu koi reply nhi diya