While+break calculator practice (lesson 26.1)
Unsure how to take/sort both int+string input and how to input my sum equation to tally only once. Been butting my head on this for a few days and haven't asked for any help so far but I'm sure it's not a super complex solution and I wanna move past it aha Here is my current code: sum = 0 while True: x = input() #your code goes here sum += int(x) print(sum) This seems to be a working calculator, but I'm unsure how to: a) have it sum the inputs only once, as the output asks for a single value (I'm sure its a matter of putting print sum at a different line or indent level, not sure exactly how though) b) take both integer inputs (since input defaults as string) as well as string, to process both number values and the 'stop' command. Ideas have included adding lines such as: x = int(input()) If x #or input() == int()/int(input()): sum += x if x #or input() == ("stop") #or str("stop"): break