Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getop(str):
- list_ops ='+ - / *'.split()
- for op in list_ops:
- find_op = getloc(str,op)
- op_was_found = bool(find_op[l])
- op_found_location = find_op[0]
- if op_was_found:
- print(f'Found {op} in {str} at {op_found_location}')
- return op, op_found_location
- def getoperands(str):
- getop = getop(equation)
- op = getop[0]
- op_loc = getop[1]
- print(f'op is {op} at location {}')
- operand_1 = str[:op_loc]
- operand_2 = str [op_loc:]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement