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
anzhelika [568]
3 years ago
7

Write a Python program that asks the user to enter a series of single-digit numbers with nothing separating them.

Computers and Technology
1 answer:
d1i1m1o1n [39]3 years ago
5 0

The Python 3 code for the program described in the question:

def sum_digits(str):

sum = 0

for c in str:

sum += int(c)

return sum

def main():

print("Enter series of single-digit numbers with no spaces: ")

str = input()

print("The sum of digits of the entered number is", sum_digits(str))

main()

You might be interested in
You have found an old dusty computer in your basement that you can identify as an original IBM PC. You ask your friend if he kno
fredd [130]

Answer:

Pentium

Explanation:

8 0
3 years ago
"Consider yourself driving with 60 miles/hour in a city that has only grid like streets, and your GPS is broken.The specificatio
timama [110]

Answer:

see explaination

Explanation:

// Include the necessary header files.

import java.io.*;

import java.util.Random;

import java.lang.Math;

// Declare a class

public class GPS

{

// Definition of the function.

public static int randSel(int start, int fin)

{

// Declare the object of a class.

Random r = new Random();

// Declare an integer value and store

// value in it.

int rNum = r.nextInt((fin - start) + 1) + start;

// return value.

return rNum;

}

// Definition of the function.

public static double DistFromOrig(double X, double Y)

{

// Declare a double variable.

double dist;

// Calculate the distance.

dist = Math.sqrt(X * X + Y * Y);

// return distance.

return dist;

}

// Start the main method.

public static void main(String[] args)

{

try

{

// declare variables

double X = 0, Y = 0;

int time = 60;

final int NORTH = 0;

final int EAST = 1;

final int SOUTH = 2;

final int WEST = 3;

int Direction = 0;

// Start the while loop

while (time > 0)

{

// check whether the time is greater

// than 5 or not.

if (time >= 5)

{

// update the value of time.

time -= 5;

// call to the method.

Direction = randSel(0, 3);

if (Direction == NORTH)

{

// update the value of y cordinate.

Y = Y + 5;

// display the statement on console.

System.out.println("MOVED NORTH");

}

// Check the direction

if (Direction == EAST)

{

// update the value of x cordinate.

X = X + 5;

// display the statement on console.

System.out.println("MOVED EAST");

}

// Check the direction

if (Direction == WEST)

{

// update the value of x cordinate.

X = X - 5;

// display the statement on console.

System.out.println("MOVED WEST");

}

// Check the direction

if (Direction == SOUTH)

{

// update the value of y cordinate.

Y = Y - 5;

// display the statement on console.

System.out.println("MOVED SOUTH");

}

}

else

{

// Check the direction

if (Direction == NORTH)

{

// update the value of y cordinate.

Y = Y + time * 1;

time = 0;

}

// Check the direction

if (Direction == EAST)

{

// update the value of x cordinate.

X = X + time * 1;

time = 0;

}

// Check the direction

if (Direction == WEST)

{

// update the value of x cordinate.

X = X - time * 1;

time = 0;

}

// Check the direction

if (Direction == SOUTH)

{

// update the value of y cordinate.

Y = Y - time * 1;

time = 0;

}

}

}

// Display the statement on console.

System.out.println(

"Distance of Car After Traveling 1 Hr is "

+ DistFromOrig(X, Y)

+ " miles");

}

// Start the catch block.

catch (Exception e)

{

e.printStackTrace();

}

}

}

4 0
3 years ago
I need help!! I decided to go back to college this year and am taking Intro to Logic and Programming. I have an assignment due t
Artist 52 [7]

Answer:

Monday Video: 5.4.20 Section 18.5

Work due: 18.5 Worksheet

CW

Tuesday Video: 5.5.20 Section 18.6

Work due: 18.6 Worksheet

HW

Wednesday Video: 5.6.20 Section 18.7

Work due: 18.7 Classwork

CW

Thursday Video: 5.7.20 Section 18.7

Work due: 18.7 Homework

HW

Friday Video: 5.8.20 Section 18.5-18.7

Work due: Textbook page 615 #5-19 (not #13)

HWaccuracy

Explanation:

7 0
2 years ago
Which of the following statements about the OSI is FALSE?A. The OSI model encourages modular design in networking.B. Each protoc
Afina-wow [57]

Answer:

The correct answer to the following question will be Option B.

Explanation:

<u>Open System interconnection:</u>

  • A practical and conceptual layout that describes network communication that will be used by the systems that are accessible to interconnection as well as other systems, is called the OSI model. This may also be referred to as the OSI model with seven layers.
  • The OSI model aims to direct developers and creators so that they would modularize with the wireless communication devices and computer programs they build, and to promote a consistent structure that defines the features of a network or telecom system.

Therefore, Option B is the right answer.

8 0
3 years ago
HURRY PLS
gogolik [260]

Answer:

the testing team

Explanation:

because even though she may have fulfilled the requirements but she still need to test if it runs perfectly or not

7 0
1 year ago
Other questions:
  • To select all the text in a document, press ____.
    12·2 answers
  • This is not school related in anyway but. I used to play this videogame on my computer years ago, but i cannot remember the name
    13·2 answers
  • Use NumPy to recreate your answer to Question 1b. The input parameters will both be python lists, so you will need to convert th
    8·1 answer
  • Write a program that first reads in the name of an input file and then reads the input file using the file.readlines() method. T
    14·1 answer
  • Which best describes what online reading tools aim to help readers do? *100 POINTS*
    9·2 answers
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • In 4-bit sign magnitude representation, what is the binary encoding of the number -5?
    15·1 answer
  • Write a static method named contains that accepts two arrays of integers a1 and a2 as
    14·1 answer
  • The __________ operator increases the value of the variable by 1 after the original value is used in the expression in which the
    7·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!