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
The U.S. consumes lots of energy. Which fuel provides the most energy?
Nadya [2.5K]

Answer:

<em>Natural</em><em> </em><em>Gas</em>

Explanation:

..............

7 0
2 years ago
Read 2 more answers
Database management systems _____. a. include transaction-processing reports for database analysis b. are used to create, organi
GaryK [48]

Answer:B. Are used to create, organize, and manage databases

Explanation: Database management system (DBMS) is a computer software which is used to collect, analyse or evaluate and retrieve data from a database. It is essential to the flow of businesses or other activities of an organisation.

Examples of database management system softwares MICROSOFT ACCESS,FOXPRO,ORACLE etc all this are effective as it helps to manipulate the data structure,field names,the file formats etc.

3 0
3 years ago
Given a line of text as input, output the number of characters excluding spaces, periods, or commas. If the input is:
enot [183]

In python 3.8:

print(len([x for x in input("Enter your text: ") if x not in "., "]))

I hope this helps!

3 0
3 years ago
What are the disadvantages of a server-based network? -lack of centralized network security - need for a network administrator -
tigry1 [53]

Answer:

The server-based network has some disadvantages such as hardware-accelerated which is affordable. Effective operating system with a network. Requires a dedicated system administrator.

Explanation:

  • When one of the databases drops south all the people are being affected and the whole network can even be downgraded.
  • Costlier to set up and maintain.
  • Expensive: - The expensive server hardware equipment, database software platforms, and network installation can require significant source host and system administrator.
  • Administrating:-  Appears to require continual servicing by the system administrator and admin must behave with the relevant skills to preserve also that network infrastructure tracking is an important requirement.
  • Server Failure: - The complete functionality of the system is hosting events. If the server crashes, the whole system will go away even though all the customers rely solely on the computer.
  • Heavy Traffic:- The server is the infrastructure for managing entire elements of the organization that offer the server overload. Internet traffic will be even more relevant as the customer must start their contact session from boot time to disconnect. System routing must be properly maintained otherwise it tends to lead this same computer as a crowded state or the standard processes will be affected.
5 0
3 years ago
What tells the hardware what to do and how to do it?
oksano4ka [1.4K]

Answer:

I think its CPU

Explanation:

8 0
2 years ago
Other questions:
  • Janeal spends her day looking at the stock and bond markets and evaluating how the portfolios of the businesses she serves will
    5·1 answer
  • When creating an input control (for example, a button) on a form the _____________ indicates the data that is contained in the n
    13·1 answer
  • __________%of the users have left websites in frustration due to poor navigation.
    13·1 answer
  • Help me plase will give brainliest
    12·2 answers
  • The ________letter of the first word in the Complimentary Closing has a capital letter, everything else is keyed in lower case o
    8·1 answer
  • One of the most common uses of spreadsheet are
    8·1 answer
  • What channel does the news come on? <br><br> i dont have cable i have roku :\
    8·1 answer
  • Please answer me fast ​
    6·2 answers
  • Phoebe is a Counselor who is trying to schedule a meeting with one of her patients. Which best describes an inappropriate locati
    10·2 answers
  • before you start researching fleet management software, your first task is to clearly define the problem. this will help guide y
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!