I’m making a little calculator in python. Here’s the code so far.
while True:
operatio = input('Enter here: ')
operation = operatio + ' '
tempnumstr = ''
numlst = []
operationstr = ''
for i in operation:
if i.isnumeric() == True:
tempnumstr += i
else:
operationstr += i
numlst.append(tempnumstr)
tempnumstr = ''
print(numlst)
print(operationstr)
Basically I’m trying to isolate the numbers and the operation so I can then have it do that operation. If I input 18 + 12, for example, the output it will give is:
['18', '', '', '12']
+
I want to output to be this:
['18', '12']
+
Is there some way for me to do this?