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.
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)
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)
@@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
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],'
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!
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 : 😑😑
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!!!
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)
This is the most code intensive lecture.......thanks bhaiya😊😊😊😊 and pls everyone like share its dissapointing that likes are decreasing video by video.....😐😐😐😐
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$$$😌
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 🙏🙏🙏
please🙏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 Sir, abhi tak 10-15% hi padha h{pcm me} please 3 months me kaise syllabus compelete karke revise karu?🙏🙏🙏 Please 🙏🙏🙏👍👍👍 Much needed🙏🙏 Huge request 🙏🙏 Please think on it🙏🙏 Don't ignore 🙏🙏🙏
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
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.
best of luck everyone jiska bhi subah exam hai
Are you ready ?
@@letsamaze7072 nha bro
No bro
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😅
11:25 the most epic part🤣🤣🤣
😂 Seriously...
All the best to all for today's exam
pls post notes for this video notes are the best parts of the series
Abbe Yeh code h Iske koi notes thodi hain lmao
Best in the world "Aman dhattarwal" zabardast.
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],'
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
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('
')
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?
All the best for you 2 april 2024 Exam ❤
Thanks a lot :)))
Love to the apni kaksha team
Aman bhaiya zindabad....🙏🙏🙏
All the best for your 29 March 2025 exam❤
12:30 most epic
NOTES UPLOAD KAR DO BHAIYA!!!!!
PRACTICALS AND PRE BOARDS H
11:23 🤣🤣🤣🤣
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
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
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!
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 😂
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
14:09 wahi to nhi hai 😐🙃
are ch==5 k niche break dene se kay kisika error dikah raha h?? error- break outside the loop
Sir pls phy ka second books ka notes dedijiye mra preboards hai
What 'bout my notes?🙈
Take it easy 😂👍
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
Thank you so much Aman Bhaiya and Team 🙏🏻
Thankyou bhaiya!!☺️☺️☺️
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 !?
Thnx sir😊😊
Sir
Syllabus kab complete hoga??
thank you for such great lecture harsh sir you teach really well
Thanks
Sir kya MySQL ki bhi classes hongi?
videos available kindly check
सी please लॉन्च cs series for tomorrow board paper
how can this code be used for string value
Thank u sooo muchh bhaiyaaa
Stay blessed
Eat well, Sleep well and study well...🙂
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
One day before exam. Willl. Like 😂 👍
Bhaiya wave optics ke notes aur semiconductor ke notes Bhi Daal dijiye aap TH-cam par ....🙏
Wave optics already uploaded on discord
Can anyone explain to me what this %d and %item is for?
bhaiya huge huge huge request to u pls upload aldehyde ,ketones notes 🙏🙏🙏🙏🙏🙏🙏🙏
Sir ' global ' variable should be used in every function definition for top. without it, it is showing error
Aman bhaiya please assembly language programing bhi karo na
Sir vector chapter ka vedio banaiye
Sir pehle h
jinka video slow krk dekhna pad rha h
Sir,
IP walo ka lia plz... Pythan or my SQL ka corse dalo plz...
🙏🙏🙏🙏🙏
I who also want...
Bhai top ki value len-1 kaise h?
top kyuki top element alag se treat kiya gaya hai
ussko special mention kiya hai
can someone tell what's the text editor or software he's using?
Vs text editor
@@shreeyansh-x5l thanks man
Can anyone please tell me where we can find new notes of wave optics by Aman bhaiya?
Discod server☺
@@munmun2830 kon sa?
This is the most code intensive lecture.......thanks bhaiya😊😊😊😊 and pls everyone like share its dissapointing that likes are decreasing video by video.....😐😐😐😐
Sir notes ka link daal do
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$$$😌
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
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..
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
what is the use of %d here?
just a future reference operator ..
great video bro
i laughed when the first output come, at the very first time
Dosto ye %d kya h?
Yeh to bahut lamba program haii....
Exam m stack queue se related kaise questiom ayenge???
Ye )practical me aa skta hai?
10 bjne wale hain aur mein pop top par rha... 🫠
Bhaiya hadd se jyaada ad daalte hai 💀
Description mai code Kaha hain
Please share it's notes
bhaiya IP vaalo ke liye bhi krdo kuch plz 🙏🙏🙏🙏
sir plsss give discord link jo description main thi wo wali expire ho gyi
Ye konse applicatⁿ pe code likha or run kraya??
Re-upload old videos of C++ for Class 12
Sir plz jaldi jaldi cs python ka pura syllabus kar va dijiye for baords
As we are having our pre boards in February
Bhaiya yae kya boards kae exam mae aata hai....practicals mae...plz koyi bataoo
Bhaiya Konsa version use karte ho python ka
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 🙏🙏🙏
link to the notes not given
Sir please provide the link of the code 🙏🙏
Bhai java k liye bhi kuch
7:20
Andhe 1-5 daalna tha...😂😂
Agli baar se mai bhi 'Andhe 1-5 daalna tha' hi dalunga else condition me🤣
Kitna confusing h yrr😌😄😄
Please upload notes of this lecture
Kon kon aj subah dekh rha(2 April)😂
11:25 bro fr harrassing user💀💀💀💀
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 🎉
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
Kis application pe code krte ho bta do please
Vs code
which python software u r use?
vs text editor
bro hamari teacher ne hamse sign karva liye ki 60 % stack me nahi ay to 1week ke liye suspension.
mtlb?
Where are the notes of this lecture???....not there in the description box
please🙏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
Sir, abhi tak 10-15% hi padha h{pcm me} please
3 months me kaise syllabus compelete karke revise karu?🙏🙏🙏
Please 🙏🙏🙏👍👍👍
Much needed🙏🙏
Huge request 🙏🙏
Please think on it🙏🙏
Don't ignore 🙏🙏🙏
CHUD GYI DIDI TUM TO XD
Sir es playlist ke poore notes toh upload kr dete..
How to get this code file?
diy
Maza AYA !!!!
Sach h na
Yahan %d kya hai??
Aap vs code m code krte ho na
awesome!
Notes kaha hai???
Which software is this ?