+ 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 .

2nd Jan 2021, 2:04 PM
Iron Coder
Iron Coder - avatar
1 Answer
+ 1
use eval() evaluate ex. print(eval(40+3041)) and the eval function is not limited to addition it is also other operations
2nd Jan 2021, 3:33 PM
Ireneo language