Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def evaluate_expression(expression):
- if expression[0] == 'f':
- return expression[-1]
- if len(expression) == 5:
- if expression[0] == 't':
- return expression[2]
- shorter_expression = expression[2:-2]
- return evaluate_expression(shorter_expression)
- input_str = input()
- expression = input_str.replace(" ", "")
- result = evaluate_expression(expression)
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement