0
I have to add n numbers. code that it will first ask how many input you want to take. And then it will take all n input to add.
Python 3 coding
2 Answers
0
sum,a=0,int(input('how many num u got:'))
for i in range(a):sum+=float(input('enter the num: '))
print(sum)
+ 5
You could approach the task like this:
* create a variable s for sum, that has the value 0
* take input n using the input() function
* convert n to an integer using int()
* use a for-loop to get n inputs
* covert the inputs to integer and add them to s
* output s using print() after the loop
if you already have a code, please show it so we can help you