1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andrew11 [14]
3 years ago
7

Design a program that asks the user to enter a string containing a series of single digit numbers with nothing separating them.

The program should display the sum of all the single digit numbers in the string. For example, if the user enters 2514, the method should return 12, which is the sum of 2, 5, 1, and 4. (Hint: The stringToInteger library function can be used to convert a single character to an integer.)
Computers and Technology
1 answer:
ruslelena [56]3 years ago
7 0

Answer:

  1. def calcSum(d):
  2.    sum = 0
  3.    for x in d:
  4.        sum += int(x)
  5.    return sum
  6. digits = input("Please enter your digits: ")
  7. 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).

You might be interested in
Q2: Mark True or False in the corresponding Answer sheet (0.5 point each)
Zinaida [17]

The answers to the question are:

  1. True
  2. True
  3. True
  4. True
  5. False
  6. true
  7. True
  8. True
  9. False
  10. False
  11. false
  12. False
  13. True
<h3>Which words are combined to form malware?</h3>

Malware is known to be a kind of malicious software and it covers  viruses, worms, trojans and other bad computer programs that is often used by hackers to wreak and steal information from system.

The types Of Expansion Cards are:

  • Sound Card
  • Graphics Card
  • Network Interface Card
  • Modem,

A sound card known as an audio card which is said to be an internal expansion card that helps to give input and output of audio message to and from a computer system.

Learn more about  sound card from

brainly.com/question/26964065

#SPJ1

3 0
2 years ago
ECG mashine is an example of
andrezito [222]

Answer:

test

Explanation:

a test that measures the electrical activity of the heartbeat

8 0
3 years ago
What is the function of the keyboard shortcut Ctrl+Shift+E in a word processor
Masja [62]
<span>toggle your tracking on or off</span>
4 0
3 years ago
Read 2 more answers
The director of security at an organization has begun reviewing vulnerability scanner results and notices a wide range of vulner
gayaneshka [121]

Answer:

D. Network vulnerability database

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

In this scenario, The director of security at an organization has begun reviewing vulnerability scanner results and notices a wide range of vulnerabilities scattered across the company. Most systems appear to have OS patches applied on a consistent basis but there is a large variety of best practices that do not appear to be in place. Thus, to ensure all systems are adhering to common security standards a Network vulnerability database, which typically comprises of security-related software errors, names of software, misconfigurations, impact metrics, and security checklist references should be used.

Basically, the Network vulnerability database collects, maintain and share information about various security-related vulnerabilities on computer systems and software programs.

5 0
3 years ago
A technician mistakenly uninstalled an application that is crucial for the productivity of the user.
BARSIC [14]
I think the answer is a
7 0
3 years ago
Other questions:
  • Which of the following functions and expressions will convert the ASCII character "Z" to its numeric equivalent ASCII code?
    7·1 answer
  • How many seconds are required to make a left turn and join traffic?​
    11·2 answers
  • Suppose the price of a complement to LCD televisions falls. What effect will this have on the market equilibrium for LCD​ TVs? T
    13·1 answer
  • Kathy created a video presentation of her company, which will be shown on a television show as an advertisement. Her company wan
    11·1 answer
  • The local city youth league needs a database system to help track children that sign up to play soccer. Data needs to be kept on
    10·2 answers
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • Compare gigabytes GB, kilobytes and terabytes.​
    11·1 answer
  • PLS ANSWER ASAP!!!! <br><br> In three to five sentences, explain the function of utilities.
    13·1 answer
  • . Question 2 Fill in the blank: R Markdown notebooks can be converted into HTML, PDF, and Word documents, slide presentations, a
    9·1 answer
  • Write the following short piece of code in python:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!