I'm learning python, and I have encountered a problem.
for i in input:
operator = i.split()[0]
number1 = i.split()[1]
number2 = i.split()[2]
equation = (number1 + ' ' + operator + ' ' + number2)
This code is supposed to calculate a randomly generated input, for example:
+ 9 16
this one wants me to print the result of 9 + 16
so I made code which converts the input into an equation but i have no idea how do tell the code to calculate it.
Could anybody help me?