+ 1

Adding Strings

so I'm basically making a calculator which will be able to handle an infinitely long operation with only the basic four operators (addition, subtraction, multiplication and division.) Im basically trying to accomplish this by creating two lists, one holding the operators respectively in the way they were listed and the other one containing the full numbers (not just single digits), so then I can make a loop that will through the order of operations and produce an output. I'm having a bit of trouble combining a string type variable and a list item (which is a number) the problem is I can't convert that list item to a string, I'm obviously missing something incredibly simple, any help. Here's the code http://www.sololearn.com/app/JUMP_LINK__&&__python__&&__JUMP_LINK/playground/cQGXO7fM9ZBE/

8th Jul 2016, 3:25 AM
Enclo Creations
Enclo Creations - avatar
3 ответов
+ 1
You have bad if condition.try to print it in this way: print(not operation[i2]) if not operation[i2] in num not of every item in operation is false.so...just use positive logic - if operation[i2] in num. but then reverse code in if and else blocks.have a nice day;-)
8th Jul 2016, 7:49 AM
vetarikisa
+ 1
the printing works fine :\
8th Jul 2016, 1:46 PM
Enclo Creations
Enclo Creations - avatar
0
if you print(not operation[i2]) you will get false for every i2.
8th Jul 2016, 3:21 PM
vetarikisa