Skip to content

Commit a169332

Browse files
committed
numbers also added
1 parent 4c6d255 commit a169332

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

infix_to_postfix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def seek(self):
2626
return self.items[self.size]
2727

2828
def isOperand(self, i):
29-
if i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
29+
if i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" or i in "0123456789":
3030
return True
3131
else:
3232
return False
@@ -67,7 +67,7 @@ def infix_to_postfix(self, expr):
6767

6868

6969
s = Stack()
70-
expr = "(A+B)*C"
70+
expr = "(1+2)*3"
7171
result = s.infix_to_postfix(expr)
7272
if result != False:
7373
print("the postfix of :", expr, "is", result)

0 commit comments

Comments
 (0)