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]
4 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]4 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
ནས་ད་ དང ་ ་ ་ ་ ་ Az - . Al & Co (NO) - Cat Al (NO) 0 --- - 2N: H2 +0 h20​
Tamiku [17]

Can you be more clear???

7 0
3 years ago
AYUDAAA..... DARÉ TODOS LOS PUNTOS QUE PUEDA.
Eddi Din [679]

Answer:

HELP ... I WILL GIVE ALL THE POINTS IT CAN.

THE QUESTIONS ARE:

1. ACCORDING TO THE SUBCLASSIFICATION OF EACH WEB SITE AS YOU WOULD DEFINE THE TYPES OF THE WEBSITE.

2. WHAT IS THE DIFFERENCE BETWEEN EACH SUBCLASSIFICATION OF THE WEBSITES

3. LIST EXAMPLES OF EACH SUBDIVISION

THE SUBCLASSIFICATIONS IN QUESTION ARE: SITE BY HEARING, BY DYNAMISM BY OPENING, BY DEPTH AND BY OBJECTIVE

Explanation:

What is the question needed to be answered?

3 0
3 years ago
A competitor goes to your public website and discovers that they can get into a directory that you did not know could be reached
Ivan

Answer:

Yes, directory traversal attack.

Explanation:

A website is a collection big web pages hosted on a web server. It contains contents like links and sometimes directory root paths. This a vulnerability attacks an exploit to access the information in a database.

There are two access to a database. One is the authentication process issued for authorised user access and the other is the root access only accessible to the network administrator. It contains paths to directories in the servers.

A directory traversal attack or path attack is done through a web browser by an attacker, who seeks for a weak path link on the public's website and accesses the information in the server.

5 0
3 years ago
Which toolbar is located next to the office button and contain the commonly used commands​
Andrei [34K]

Answer: Quick Access Toolbar

The Quick Access Toolbar is located to the right of the Microsoft Office Button . It contains commands that are used most often, for example Redo, Undo and Save.

Explanation:

7 0
4 years ago
The ListCell subclass’s ________ method creates the custom presentation. This method is called by the ListView’s cell factory wh
Vlada [557]

Answer:

A

Explanation:

Update

The listview can be called an arbitrary amount of times, different items may be passed and the cell can go from empty to non-empty and the other way round. ListView creates about as many cells as you see on screen and fills them with items. E.g. scrolling or modifications of the items list or resizing of the ListView can result in updates.

7 0
3 years ago
Other questions:
  • You grant them remote access to your computer to enable them to act as you to fix the situation. what type of os must be install
    9·1 answer
  • What is the name of Louis and Auguste Lumiere's invention that incorporated a camera, a printer, and a project all in one machin
    8·1 answer
  • Import java.util.scanner; public class sumofmax { public double findmax(double num1, double num2) { double maxval; // note: if-e
    10·1 answer
  • Which person would be the best fit for a career in the information technology field?
    14·1 answer
  • PLEASE HELP!! HELP ME
    10·1 answer
  • Five differences between monitor and printer
    15·1 answer
  • Which type of financial institution typically has membership requirements?
    11·1 answer
  • A cookie filter blocks the sending and receiving of cookies. Blocking cookies can reduce some threats of session tracking and id
    12·1 answer
  • Discuss the causes ,symptoms, preventive measures and treatment of AIDS​
    6·2 answers
  • What type of memory disappears when you turn your computer off? CPU, RAM, ROM or Storage​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!