Answer:
- def calcSum(d):
- sum = 0
- for x in d:
- sum += int(x)
- return sum
-
- digits = input("Please enter your digits: ")
- print(calcSum(digits))
Explanation:
The solution code is written in Python.
Firstly, create a function that take one input digit string (Line 1).
In the function, create a sum variable with initial value 0.
Use a for loop to traverse through each character in the digit string and in the loop use int method to convert each character to integer and add it to sum variable (Line 3-5) and return the sum as output.
Next, use input function to prompt user enter a digit string (Line 7).
Lastly test the function by passing the input digit as argument and print the result (Line 8).
Of course yes, and that depends of the type of content that you eaten =D
Media is a source of good information for to create your opinion.
Best regards
This isn't related to computers and when you look it up all it comes up with a Stars Wars.
Answer:
Give at least one reason why it's useful to learn how to solve and program solutions with a limited set of commands. So that when there is more commands we know how to use the ones we have. parameters help generalize the solution to a specific problem. how are functions with parameters an example of abstraction?