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
satela [25.4K]
3 years ago
9

Write a function in python that computes and returns the sum of the digits for any integer that is between 1 and 999, inclusive.

Use the following function header: def sum_digits(number): Once you define your function, run the following examples: print(sum_digits(5)) print(sum_digits(65)) print(sum_digits(658)) Note: Do not hard-code your function. Your function should run for any number between 1 and 999. Your function should be able to decide if the number has 1 digit, 2 digits, or 3 digits.
Computers and Technology
1 answer:
DanielleElmas [232]3 years ago
3 0

Answer:

def sum_digits(number):

   total = 0

   if 1 <= number <= 999:

       while number > 0:

           r = int (number % 10)

           total +=r

           number /= 10

   else:

       return -1

   return total

   

print(sum_digits(658))

Explanation:

Write a function named sum_digits that takes one parameter, number

Check if the number is between 1 and 999. If it is, create a while loop that iterates until number is greater than 0. Get the last digit of the number using mudulo and add it to the total. Then, divide the number by 10 to move to the next digit. This process will continue until the number is equal to 0.

If the number is not in the given range, return -1, indicating invalid range.

Call the function and print the result

You might be interested in
A pointing device controls the movement of the ____.
andrey2020 [161]
<span>A pointing device controls the movement of the </span>Mouse Pointer
3 0
3 years ago
It's the same drop-down answers for both.
tia_tia [17]

Answer:

First, medium: can see all the subject but maintain the focus in him

Second, close-up: To se the facial expressions and emotions

5 0
2 years ago
The ____ section of the project plan should describe the major project functions and activities and identify those individuals w
harkovskaia [24]

Answer:

Option(c) is the correct answer to the given question .

Explanation:

The Project responsibilities section is responsible of the planning of project.

Following are the Roles of the Project Responsibilities

  • To check the objective of the project goals.
  • Works with customers and  to define and meet client needs and the overall objective .
  • Cost estimation and expenditure production of the project
  • Ensure the fulfillment of the client .Analysis and enterprise risk management. and Tracking the progress of project.

All the others options are not responsible of the planning of project that's why Option(c) is the correct answer .

7 0
3 years ago
NEED HELP ON TEST!!!
Phoenix [80]

Answer:

1.  \: speaker \:  notes \\ 2. \: accessible

5 0
3 years ago
Which two settings must you configure when fortigate is being deployed as a root fortigate in a security fabric topology?
Goryan [66]

The two settings that one must configure when fortigate is being deployed as a root fortigate in a security fabric topology are:

  • Option A. Enables you to view the logical and physical topology of Security Fabric devices.
  • Option  C. Enables you to view the security ratings of FortiGate Security Fabric groups.

<h3>What is security fabric settings?</h3>

The term Security Fabric is known to be a tool that aids one or allows one's network to be able to automatically see and also dynamically isolate any kinds of affected devices.

Note that is one that can also partition network segments, update rules, and they can bring out new policies, and delete malware.

Hence, The two settings that one must configure when fortigate is being deployed as a root fortigate in a security fabric topology are:

  • Option A. Enables you to view the logical and physical topology of Security Fabric devices
  • Option  C. Enables you to view the security ratings of FortiGate Security Fabric groups.

See full question below

Which two Security Fabric features are on FortiManager? (Choose two.)

Select one or more:

A. Enables you to view the logical and physical topology of Security Fabric devices

B. Enables you to run security rating on FortiGate devices

C. Enables you to view the security ratings of FortiGate Security Fabric groups

D. Enables you to view and renew Security Fabric licenses for FortiGate devices

Learn more about security from

brainly.com/question/25720881

#SPJ1

8 0
2 years ago
Other questions:
  • Let's assume that the smallest possible message is 64 bytes (including the 33-byte overhead). if we use 100base-t, how long (in
    10·1 answer
  • Which of the following is NOT a Boolean Search term used to refine search engine results? A. AND B. With C. OR D. NOT
    14·2 answers
  • 1. What is the central idea of the section "Service Record." Use two text details to
    8·1 answer
  • Which of the following operating systems is able to join a domain a) Microsoft office pro b) Microsoft surface R.T. c) google an
    9·2 answers
  • How do you get the computer to stop opening randomly
    15·2 answers
  • Please help quickly!!! which of the following is not a peripheral?
    8·2 answers
  • How to solve household arithmetic​
    7·1 answer
  • dash is a set of communication standard using for transferring file information between computers in a network​
    5·1 answer
  • Difference between a port and a connector
    10·1 answer
  • if a hacker wants to exploit the TCP three-way handshake, what is the most effective way to go about it?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!