import sys def main(): print("--------------------------") print(" TPC2 Somador on/off ") print("--------------------------") is_on = False sum = 0 for line in sys.stdin: line = line.strip() if is_on and line.isdigit(): sum += int(line) elif line == "=": print(f"Result -> {sum}") elif line.lower() == "on": is_on = True elif line.lower() == "off": is_on = False elif line.lower() == "quit" or line.lower() == "q": break print("Bye!") if __name__ == "__main__": main()