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).
The code segment makes use of conditional statements.
Conditional statements in programming are used to make decisions
The code segment in C++ is as follows
if (score > 90) {
grade = 'A';
}
else if (score >= 80 && score < =90) {
grade = 'B';
}
else {
grade = 'C';
}
The above code segments take the score, make comparison, and then determine the appropriate letter grade.
Read more about code segments at:
brainly.com/question/20475581
My name is Trisha Davis, I am a first year medical student and i love to read and write books. I hate lies and i love anyone who is honest.
<h3>What is self introduction?</h3>
My name is Trisha Davis, I am a first year medical student and i love to read and write books. I hate lies and i love anyone who is honest.
My goal in life is to be a medical doctor and also an entrepreneur. I love to help others and put smile on people's face. What i want from life is good health, favor and avenue to showcase my gifts to the world.
Learn more about self introduction from
brainly.com/question/26685169
#SPJ1
Answer:
1000
Explanation I SEARCHED IT Up
Chiptune, also known as chip music or 8-bit music, is synthesized electronic music which is made for programmable sound generator suns chops used in vintage computers,consoles , and arcade machines.