Advertisement
ajorpheus

scrimba

Oct 26th, 2021
1,610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def getop(str):
  2.     list_ops ='+ - / *'.split()
  3.     for op in list_ops:
  4.         find_op = getloc(str,op)
  5.         op_was_found = bool(find_op[l])
  6.         op_found_location = find_op[0]
  7.  
  8.     if op_was_found:
  9.         print(f'Found {op} in {str} at {op_found_location}')
  10.         return op, op_found_location
  11.  
  12. def getoperands(str):
  13.     getop = getop(equation)
  14.     op = getop[0]
  15.     op_loc = getop[1]
  16.     print(f'op is {op} at location {}')
  17.     operand_1 = str[:op_loc]
  18.     operand_2 = str [op_loc:]
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement