https://code.sololearn.com/c3NiY3MtCRKY/?ref=app So, basically, I don’t understand a thing after “operation” string begins and etc. Could someone here make me the analysis, please? I would appreciate it very much
operation = [add,subtract,divide,multiply] options = ["+", "-", "/", "*"] When the user makes their choice (for this example, they choose "-"), the variable 'user_choice' is defined by options.index(choice). Now, 'choice' here is "-", so options.index("-") is 1. So 'user_choice' is defined as 1. The line you say you are having trouble understanding is math = operation [user_choice] (num1, num2) 'user_choice' is 1, so this line becomes math = operation  (num1, num2) Now, operation is the second element of operation, which is subtract. So operation returns subtract. The line now is effectively math = subtract(num1, num2) which is the function call for subtract() with the arguments 'num1' and 'num2'.
i get the idea of def, it is easy but what comes after that - operation, options, choice and most importantly: math = operation [choice] (num1, num2). I just cannot get why
god. it’s still quite hard, but you made it easier, thank you very much
help my code does not iterate