Click here to Skip to main content
15,887,272 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do i rewrite these functions in using -1 without using len at all



Python
def pushProjectStack(pkt,stk):
   contentsStack(stk).insert(len(contentsStack(stk)),pkt)
   
 

def popPickupStack(stk):
   x = len(contentsStack(stk))
   contentsStack(stk).pop(x-1)


What I have tried:

i dont know what to try plz help meee
Posted
Updated 27-Nov-22 23:43pm
v3
Comments
Richard MacCutchan 28-Nov-22 4:09am    
What do you mean by "using -1 without using len"?

1 solution

Try reading the documentation[^] - specifically for the pop and append methods.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900