Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy /
20141125aImplement a Stack class Write a class that implements the stack data structure. We want to use the class the following way: s = Stack() # create an empty stack print s # [ print s.empty() # True s.push(1) s.push(4) s.push(5) print s # [1 4 5 print s.size() # 3 print s.empty() # False x = s.pop() print x # 5 print s # [1 4 s.pop() s.pop() # now it's empty x = s.pop() print x # None (means that we wanted to take an element out of an empty stack) |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |