class Stack(object): def __init__(self): self.lst = [] def push(self, item): self.lst.append(item) def isEmpty(self): return len(self.lst) == 0 def pop(self): item = self.lst[-1] del self.lst[-1] return item def __len__(self): return len(self.lst) def __str__(self): return str(self.lst) s = Stack() s.push('plate 1') s.push('plate 2') s.push('plate 3') print(s) print(len(s)) print(s.pop()) print(s.pop()) print(s.pop()) print(s.isEmpty())
Please answer question 8.35 Python 3.0 for language Comment for each part of line of code...
help finish Queue, don't think I have the right thing. # 1. After studying the Stack class and testStack() functions in stack.py # complete the Queue class below (and test it with the testQueue function) # # 2. Afer studying and testing the Circle class in circle.py, # complete the Rectangle class below (and test it with the testRectangle function) # # # 3. SUBMIT THIS ONE FILE, with your updates, TO ICON. # # # NOTE: you may certainly...
in python and according to this #Creating class for stack class My_Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def Push(self, d): self.items.append(d) def Pop(self): return self.items.pop() def Display(self): for i in reversed(self.items): print(i,end="") print() s = My_Stack() #taking input from user str = input('Enter your string for palindrome checking: ') n= len(str) #Pushing half of the string into stack for i in range(int(n/2)): s.Push(str[i]) print("S",end="") s.Display() s.Display() #for the next half checking the upcoming string...
I was told I need three seperate files for these classes is there anyway to tie all these programs together into one program after doing that. I'm using netbeans btw. import java.util.ArrayList; import java.util.Scanner; /** * * */ public class MySorts { public static void main(String[] args) { Scanner input = new Scanner(System.in); String sentence; String again; do { System.out .println("Enter a sentence, I will tell you if it is a palindrome: ");...
Please, answer the three questions. Many thanks 1 Question Which of the following methods does a stack not support? Not yet answered Points out of Select one 1.00 O a. push P Flag question O b. top O C. pop O d. pu 2 Drag and drop an appropriate item (stack, queue, or adapter) into each Question Not yet answered description below. Points out of 3.00 is a container where objects are inserted and removed according to P Flag question...
Please Answer this question using the language of C++. I provide you with the picture of figure 18_02. Thank you. I 7/ Fig. 18.2: Stack.h 2 // Stack class template. #ifndef #de fine 3 STACK-H STACK-H 5 #include 7 template 8 class Stack ( 9 public: 10 I const T& top) 12 13 l/ return the top element of the Stack return stack.frontO; // push an element onto the Stack void push(const T& pushValue) 15 stack push front (pushValue); 17...
Please Write Pseudocode or Python code! Thanks! P1. b) is the following: W1. (6 marks) Write the pseudocode for removing and returning only the second element from the Stack. The top element of the Stack will remain the top element after this operation. You may assume that the Stack contains at least two items before this operation. (a) Write the algorithm as a provider implementing a Stack using a contiguous memory implementation. You can refer to the implementation given in...
python 3.7.2 for language good variable names please comment for each line of code 1. Answer the question: when using strftime what is the placeholder that will display the full name of the day of the week (Monday, Tuesday, etc.). (ex. "%d" is the placeholder that displays the day as a two digit number) 2. Write an algorithm for step 3 3. Write a program that reads in the information from a file called ShopRecords.csv and displays all of the...
- Complete the code to solve a maze- Discuss related data structures topicsProgramming-----------In this part, you will complete the code to solve a maze.Begin with the "solveMaze.py" starter file.This file contains comment instructions that tell you where to add your code.Each maze resides in a text file (with a .txt extension).The following symbols are used in the mazes:BARRIER = '-' # barrierFINISH = 'F' # finish (goal)OPEN = 'O' # open stepSTART = 'S' # start stepVISITED = '#' #...
please make a pretty JAVA GUI for this code this is RED BLACK TREE and i Finished code already jus need a JAVA GUI for this code ... if poosible make it pretty to look thanks and please make own GUI code base on my code thanks ex: (GUI only have to show RBTree) ---------------------------------------- RBTree.java import java.util.Stack; public class RBTree{ private Node current; private Node parent; private Node grandparent; private Node header; private Node...
please answer this question with the specifice name of each part answer Q86 , Q87 , Q88 , Q89 , Q 90 , Q91 , Q92 , Q93 , Q94 12 86- Type of circuit in fig.13 is Part full name 1 2. Complete the next table. Part function A Fig.13 13 17 20 w 4 10 S 3 6 14 js 16 9 10 11 12 13 14 15 16 87-On fig. 13, Discuss type, function & importance of...