Jun-28-2018, 11:14 AM
The while loop is easy. If it's based on a variable, you just set that variable to False:
If you can expect a list like ['Add', '8', 'and', '1'], you just need to get the second and fourth items (with zero-indexing these are operation[1] and operation [3]), convert them to numbers with the built-in int(), and add them together.
while carry_on: ... if operation[0].lower() == 'q': carry_on = FalseDepending on the structure of your program, you can often simplify this to
while operation[0].lower() != 'q':
.If you can expect a list like ['Add', '8', 'and', '1'], you just need to get the second and fourth items (with zero-indexing these are operation[1] and operation [3]), convert them to numbers with the built-in int(), and add them together.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures