Skip to content

Instantly share code, notes, and snippets.

@kumarsuraj9450
Created May 19, 2020 18:16
Show Gist options
  • Save kumarsuraj9450/f633dd371f208749c10adf6f7ff07f98 to your computer and use it in GitHub Desktop.
Save kumarsuraj9450/f633dd371f208749c10adf6f7ff07f98 to your computer and use it in GitHub Desktop.
from msvcrt import getche
s = '0'
curr = ''
while True:
print('\nPRESS "Q" To EXIT')
try: e = eval(s)
except: e = eval(s[:-1])
print(f'\n{ e } ( {s} )')
curr = getche().decode()
# curr = input('exp :- ')
# if curr in ['/','*','-','+']: curr += getche().decode()
if curr.lower() == 'q': break
elif curr.lower() == 'c': s = '0'
elif s=='0' and curr: s = curr
else: s+=curr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment