TEMPLATE in Python

from typing import TypeVar, Generic, List

T = TypeVar('T')

class Stack(Generic[T]):
def __init__(self) -> None:
# Create an empty list with items of type T
self.items: List[T] = []

def push(self, item: T) -> None:

def pop(self) -> T:
return self.items.pop()

def empty(self) -> bool:
return not self.items
# Construct an empty Stack[int] instance
stack = Stack[int]()
stack.push('x') # Type error
2. do while loop in Python
The do while loop is used to check condition after executing the statement. It is like while loop but it is executed at least once.
i = 1
while True:
i = i + 1
if(i > 5):

parthanaboina praveen

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store