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
AfilCa [17]
2 years ago
14

Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate l

ine. For example, the input 16384 is displayed as 1 6 3 8 4 You may assume that the input has no more than five digits and is not negative.
Computers and Technology
1 answer:
Montano1993 [528]2 years ago
4 0

Answer:

The program in Python is as follows:

num = int(input())

for i in str(num):

   print(int(i))

Explanation:

This gets input for the number

num = int(input())

This converts the number to string and iterates through each element of the string

for i in str(num):

This prints individual digits

   print(int(i))

You might be interested in
What is the value of the variable phones after the execution of the following code? phones = {'John': '5555555', 'Julie' : '7777
uysha [10]

Answer:

phones = {'John': '1234567', 'Julie' : '7777777'}

Explanation:

In the code given in the question phones dictionary contains contains two keys John and Julie and have the values '5555555' and '7777777' respectively. Now in the code the key John in the dictionary phones is assigned the value '1234567' .So the value corresponding to the key John becomes '1234567'.

3 0
3 years ago
Write a program that generates 1,000 random integers between 0 and 9 and displays the count for each number. (Hint: Use a list o
masya89 [10]

Answer:

import random

count0, count1, count2, count3,

count4, count5, count6, count7,

count8, count9, i = [0 for _ in range(11)]

while i < 1000:

   number = random.randint(0,9)

   if number == 0:

       count0 = count0 + 1

   if number == 1:

       count1 = count1 + 1

   if number == 2:

       count2 = count2 + 1

   if number == 3:

       count3 = count3 + 1

   if number == 4:

       count4 = count4 + 1

   if number == 0:

       count5 = count5 + 1

   if number == 6:

       count6 = count6 + 1

   if number == 7:

       count7 = count7 + 1

   if number == 0:

       count8 = count8 + 1

   if number == 9:

       count9 = count9 + 1

   

   i = i+1

print("0's: "+ str(count0) + "\n"+ "1's: "+ str(count1) + "\n"+

"2's: "+ str(count2) + "\n"+ "3's: "+ str(count3) + "\n"+

"4's: "+ str(count4) + "\n"+ "5's: "+ str(count5) + "\n"+

"6's: "+ str(count6) + "\n"+ "7's: "+ str(count7) + "\n"+

"8's: "+ str(count8) + "\n"+ "9's: "+ str(count9) + "\n")

Explanation:

- Initialize variables to hold the count for each number

- Initialize <em>i</em> to control the while loop

- Inside the while loop, check for the numbers and increment the count values when matched.

- Print the result

5 0
3 years ago
Describe how a black and white image could be represented in binary
SIZIF [17.4K]

Answer:

Each pixel in an image is made up of binary numbers. If we say that 1 is black (or on) and 0 is white (or off), then a simple black and white picture can be created using binary. To create the picture, a grid can be set out and the squares coloured (1 – black and 0 – white).

5 0
3 years ago
Read 2 more answers
When you use the Copy and Paste commands, you are accessing...?
vampirchik [111]
C!!!!!!!!!!!!!!!!!!!
3 0
3 years ago
Read 2 more answers
Help!!!!!!<br>please<br>Who will give the answer I'll mark him/her as brainlist..​
damaskus [11]
17, 12.5, 6, and 10. HOPE THIS HELPS
4 0
3 years ago
Other questions:
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • A ________ is a system of hardware and software that stores user data in many different geographical locations and makes that da
    14·1 answer
  • Write a program for Horizon Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minu
    6·1 answer
  • A person clicks on an ad of a fitness club in a blog on nutrition. The person conducts a search on yoga and moves to another web
    8·1 answer
  • An increase in Consumption will ___________ in the Classical Model of Aggregate Demand.
    13·1 answer
  • Dwight <br> d. eisenhower was impressed with germany's network of highways and how it __________.
    15·1 answer
  • A(n) ________ is a specific type of computer program that manages all programs on a computer.
    8·1 answer
  • analyze the ethical issues in the use of information technology in Multinational company (MNC) and support you answer with one e
    15·1 answer
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • Write a function called changeCharacter that takes three parameters – a character array, its size, and the replacement character
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!