Adding Strings | SoloLearn: Learn to code for FREE!

+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/python/playground/cQGXO7fM9ZBE/

7/8/2016 3:25:50 AM

Enclo Creations

3 Answers

New Answer

+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;-)

+1

the printing works fine :\

0

if you print(not operation[i2]) you will get false for every i2.