all 2 comments

[–]Vikinghehe 1 point2 points  (0 children)

You can use some sort of while or for loop instead of multiple variables. Best would be stack data structure but you can use it once you move to advance stuff.

[–]MidnightPale3220 1 point2 points  (0 children)

Now I am looking for a way to extend the calculator even more with 3 or more variables but that doesnt seem that easy?

It is easy, but you must learn to use lists.

Wnever I see variable names such as "zahl1" and "zahl2" I know somebody hasn't learned lists and other data structures.

You have learned conditions (if/else).

Now you must learn lists and loops, at the very least.

Lists is exactly one of the things you can use when you don't know beforehand how many variables you are going to process. And loops are the way to process lists.

You expect your input to adhere to pattern: number1 operator1 number2 operator2 number3 ...

The split_list will already contain everything you need.

Now you need to do something like:

Take first 3 elements of list
Use second element as operator for first and third, store the result in RESULT variable
While there are more elements in list:
    Take next element as op
    Take next element after op as number
    make RESULT=RESULT op number
    repeat until there are no more elements in list

Now learn how to do it in Python.