+ 2
What is the example of code if we want to add numbers but we don't know how many inputs will be given ?
Suppose it is a calculator and a user is adding some numbers and he is giving inputs to be added but we don't know the number of his inputs. We have to add all numbers .
11 Answers
+ 1
use eval()
evaluate
ex.
print(eval(40+3041))
and the eval function is not limited to addition it is also other operations