Return the size of the stack. >>> S = Stack(3) >>> S.size() 0 >>> S = Stack(3) >>> S.push(10) >>> S.size() 1 >>> S = Stack(3) >>> S.push(10) >>> S.push(20) >>> S.size() 2
(self)
| 121 | return self.size() == self.limit |
| 122 | |
| 123 | def size(self) -> int: |
| 124 | """ |
| 125 | Return the size of the stack. |
| 126 | |
| 127 | >>> S = Stack(3) |
| 128 | >>> S.size() |
| 129 | 0 |
| 130 | |
| 131 | >>> S = Stack(3) |
| 132 | >>> S.push(10) |
| 133 | >>> S.size() |
| 134 | 1 |
| 135 | |
| 136 | >>> S = Stack(3) |
| 137 | >>> S.push(10) |
| 138 | >>> S.push(20) |
| 139 | >>> S.size() |
| 140 | 2 |
| 141 | """ |
| 142 | return len(self.stack) |
| 143 | |
| 144 | def __contains__(self, item: T) -> bool: |
| 145 | """ |
no outgoing calls