Skip to content

Pressing an operator before entering numbers shuts down the program. #13

@3rdPix

Description

@3rdPix

Describe the bug
If you press an operator before writing any number, it breaks. Output error shown:

Traceback (most recent call last):
  File "D:\gui_calculator\calculator_main.py", line 114, in plus
    if ((exist_text[-1] == "+") | (exist_text[-1] == "-") | (exist_text[-1] == "*") | (exist_text[-1] == "/") | (
         ~~~~~~~~~~^^^^
IndexError: string index out of range

Expected behavior
In Windows' calculator, number 0 is already pre-written. Operator selected applies over that 0. If new operators are chosen, old operator updates while keeping the 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions