Write a python programme to input an arithmetic expression and count the number of operators in it. Eg: +, -, / , * ; Expression = 55 - 16 * 2 ; No of operators = 2
Answers
Answered by
0
Answer:
bodmas:- bracket, division,multiplication,addition and subtraction
Answered by
2
operators = lambda s: len([op for op in list(s) if op in ["+", "-", "*", "/"]])
print("operators:", operators((s := input("string: "))))
Similar questions