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
Assuming that the actual process ids of the parent and child process are 2600 and 2650 respectively, what will be printed out at
VashaNatasha [74]

Answer:

Output explanation to the given code can be defined as follows:

Explanation:

In A the output is 0 , It will return fork value of the child process that is 0. so, 0 is printed during child process.  

In B the output is 2650 , in which the getpid() method returns the child process id  value that is 2650.  

In C the output is 140, As it is declared in key, all process have their own "value" copies. 20 are inserted during childhood, so 140 are written.  

In D the output is 2650, its fork() method returns the child ID to the parent process. so the value 2650 is printed.  

In E the output is 2600, Its getpid() method will returns parent process id  that is equal to 2600.  

In F the output is 120 Since the value is declared in primary, all process so their own "value" copies. 120 will be printed during process.

4 0
3 years ago
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion
Jlenok [28]

Direct marketing (APEX)


6 0
3 years ago
Read 2 more answers
What influential work about the Vietnam war was written by Tim O Brien
MArishka [77]
- Question -

What influenced work about the Vietnam War was written by Tim O Brian?

- Answer -

The Things They Carried

______________________________________________


These were a series of short stories O Brien wrote including in these stories his experiences with the Vietnam War



\boxed{ -  \ The \ Wolf  \  -}

4 0
2 years ago
Uso de las redes sociales como el uso de una impresora en casa se satisfacen estás tres etapas
Svetradugi [14.3K]

Question: what question is this?

7 0
2 years ago
Create a new folder in python and make it read only
igor_vitrenko [27]
Making the file read-only will not allow the file to be rewritten again. For this, we need to modify the permissions of the file. To achieve this, we will make use of the os module in Python more specifically, the chmod() of the os module.

The coding part is extremely simple and will contain very few lines as we are not doing much but changing the permissions. Using the chmod(), we can change the mode of the path, setting it to any mode using the suitable flags from the stat module. Both these modules come inbuilt with Python and hence you need not install anything additionally.

The entire code to change the file to read-only is as follows;

import os
from stat import S_IREAD
# Replace the first parameter with your file name
os.chmod("sample.txt", S_IREAD)
.

You can verify if the code was executed correctly by checking the file’s permissions. To do that :

Right-click on the file and click properties.
Under the attributes section, you will find the read-only checkbox checked.
I hope you found this article useful and it helped you make a file read-only. You can do more than just making the file read-only by using the appropriate flag from the stat module.
8 0
2 years ago
Other questions:
  • Prewritten, commercially available sets of software programs that eliminate the need for a firm to write its own software progra
    5·1 answer
  • What does the rule of five say?
    12·2 answers
  • Numeric data is stored in what for direct processing
    5·1 answer
  • List and describe four communication tools that are currently popular.
    9·1 answer
  • Write a function called printBackwards() that will work with a C string. The function will print any C string backwards. You don
    13·1 answer
  • The physical elements needed for the production of digital media, such as computers, servers, and so on are called the {Blank}
    8·1 answer
  • What are the two types of electronic components
    15·2 answers
  • B) The company's chief financial officer recognizes the need for an upgrade to the smart watches, but does not understand why th
    8·1 answer
  • Are programs that understand physics and/or hardware embedded? for example, one that uses finite-element methods to predict flui
    7·1 answer
  • Computers rarely make mistakes. True or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!