Python:
BUILT A CALCULATOR:
Let see you have a list of numbers and you want to calculate the sum of numbers present in the list.
- All you need to do is to iterate a list using a for loop and add each number to a sum variable.
- Calculate the length of a given list(total numbers in a list) and divide the sum by total length to calculate average.
calculator code:
|
calculator code |
output:
|
output |