A common test for divisibility by 3 is to add the individual digits of an integer. If the resulting sum is divisible by 3 then so is the original number. Program this test. To do this, first define a function: reduce(number) which returns the sum of the digits of the number argument. The sum returned must be < 20 i.e. if the sum is >= 20, the function must add the digits of the resulting sum. It should repeat this procedure until the sum is < 20. Use this function in a python program that inputs an integer from the user and prints out whether or not the integer is divisible by 3.​

A Common Test For Divisibility By 3 Is To Add The Individual Digits Of An Integer. If The Resulting Sum

Answers

Answer 1

The function to test for divisibilty by 3 will accept an input integers and divide it by three to check if its divisible by 3.

The function to test for divisiblity by 3 is as follows:

integer = input("input the integer to check if it's divisible by 3: ")

def reduce(integer):

    list1 = []

    sum1 = 0

    for i in str(integer):

         list1 += i

    results = list(map(int, list1))

    for x in results:

         sum1 += x

    if sum1 < 20 and sum1%3==0:

         return "The integer is divisible by 3"

    elif sum1 < 20 and sum1%3 != 0:

         return "The integer is not divisible by 3"

    else:

         while sum1 >= 20:

              z = sum(list(map(int, list(str(sum1)))))

              if z%3==0:

                   return "The integer is divisible by 3"

              else:

                   return "The integer is not divisible by 3"    

print(reduce(integer))

Code explanationThe integer variable stores the users input.We define a function called "reduce". The reduce function accepts the interger variable as a parameter.The code loop through the integer and check if it is divisible by 3. If the sum of the integer number is greater or equals to 20, we divide the resulting sum by 3 .If the integer is divisible by 3, we return "it is divisble by 3" and if it is not dividible by 3, it will return "it is not divisble by 3".

learn more on python here: https://brainly.com/question/13437928


Related Questions

Write multiple if statements:

If carYear is before 1967, put "Probably has few safety features.\n" to output.

If after 1970, put "Probably has head rests.\n" to output.

If after 1992, put "Probably has anti-lock brakes.\n" to output.

If after 2002, put "Probably has airbags.\n" to output.

Ex: If carYear is 1995, then output is:

Probably has head rests.
Probably has anti-lock brakes.

Answers

Hope this is good enough! Good luck.

This week, we have covered network management which include topics such as System message log, SNMP, Netflow, QoS, VPN, and default gateway redundancy. Discuss one feature you would implement in your network and how you use it.

Answers

There are lot of system network. I would love to implement the use of VPN in my network.

What is a gains of implementing a VPN?

The use of VPNs is one that helps a person to have a better form of total security, it also make performance better, remote access, anonymity, an others.

Conclusively, Note that the use of VPN can be  affordable as it is cheap and it can prevent hackers  having access to your data or system.

Learn more about VPN from

https://brainly.com/question/25554117

Intro to Computer Science:
A zero-tolerance policy means that if the employee violates the policy, they will be _____.
promoted
fired
warned
reprimanded

The correct answer is: fired :)

Answers

When a employee violate a zero-tolerance policy they’ll be fired!

A zero-tolerance policy means that if the employee violates the policy, they will be fired. Thus, the correct answer is option B.

What is a Zero-tolerance policy?

A zero tolerance policy is one that penalizes every violation of a stated rule. People in positions of authority are prohibited by zero tolerance policies from exercising discretion or changing punishments to fit the circumstances subjectively. They must impose a predetermined punishment regardless of individual guilt, extenuating circumstances, or history.

Zero tolerance policies are studied in criminology and are used in both formal and informal policing systems worldwide. If an employee violates the policy, there will be no tolerance and they will be fired.

Therefore, a zero-tolerance policy means that if the employee violates the policy, they will be fired.

To learn more about zero-tolerance policy, click here:

https://brainly.com/question/27293242

#SPJ2

In the 1760s and early 1770s, the British government wanted to raise money by taxing the residents of its colonies in North America. They taxed goods such as sugar and tea and even placed a tax on the printing of documents. These actions angered the colonists, who thought that taxation was unfair since they had no representation in the British government. For this reason, a group of colonists dumped hundreds of chests of tea from Britain into Boston Harbor in 1773, in what became known as the Boston Tea Party. As a result, England passed a series of harsh new laws to punish the colonists, further angering them. The Continental Congress met to voice the colonists' grievances, and eventually, on July 4, 1776, the colonists declared their independence from Britain.

Answers

Answer:

Taxes and other laws imposed on the colonies led the colonists to declare independence from England.

Explanation:

During the British government, laws taxes, and other laws increased in the colonies which led the colonists to declare independence from England.

How colonists declared their independence from Britain?

As a result, the British were forced to deploy a large army in North America on March 22, 1765, the British parliament passed the Stamp Act.

Which aimed to raise money by levying a tax on all legal and official papers and publications that were being distributed across the colonies. The Stamp Act angered the American colonists, which moved fast to oppose it.

A direct appeal to Parliament was virtually difficult due to the colony's extreme distance from London, the heart of British politics.

Therefore to raise money and increase taxes and laws colonists declared their independence on 4 July 1776 from Britain.

Learn more about the British government, here:

https://brainly.com/question/2848503

#SPJ5

Complete the sentence.

Times New Roman, Courier New, Arial and Verdana are all examples of _____.

1. web-safe colors
2. web-safe fonts
3. formatting templates
4. accessible fonts​

Answers

Answer:

web-safe fonts

Explanation:

Because if you look at the different fonts they are all readable

Answer: 2. web-safe fonts

Explanation: got it right on edgen

What command allows the root user to create a crontab file for the user jdoe?

Answers

The command allows the root user to create a crontab file for the user jdoe is As root, execute crontab -e jdoe.

What is the command in crontab?

The crontab command is known to be that often submits, make some editing, lists, or delete cron jobs.

Note that A cron job is a type of command that is often aided or  run by the cron daemon at  a consistent and scheduled times.

Conclusively, The  As root, execute crontab -e jdoe command will give room for the root user to create a crontab file for the user named jdoe.

Learn more about command form

https://brainly.com/question/25243683

Write a function named count_vowels that accepts two arguments: a string and an empty dictionary. The function should count the number of times each vowel (the letters a, e, i, o, and u) appears in the string, and use the dictionary to store those counts. When the function ends, the dictionary should have exactly 5 elements. In each element, the key will be a vowel (lowercase) and the value will be the number of times the vowel appears in the string. For example, if the string argument is 'Now is the time', the function will store the following elements in the dictionary: 'a': 0 • 'e': 2 'i': 2 'o': 1 'u': 0 The function should not return a value.

Answers

The function that counts the number of times a vowel exist in a string is as follows:

def count_vowels(string, dictionary):

    vowels = 'aeiou'

    dictionary = {}.fromkeys(vowels, 0)

    for i in string:

         if i in vowels:

              dictionary[i] += 1

    return dictionary

print(count_vowels("trouble", {}))

Code explanation.

The code is written in python.

we defined a function named "count_vowels". The function accept a string and an empty dictionary.Then. we store the vowels in a variable vowels.The dictionary is used to store the key value pair i.e the vowels and the number of times they appear.We looped through the string.If any value in the string is in vowels,  we increase the dictionary values by 1.Then, we return the dictionary.Finally, we call the function with it parameters.

learn more on function here: https://brainly.com/question/27219031

Use HTML and CSS, create a web page for the table shown below. Please copy (and paste) your code from your text editor (Replit).



Answers

This is big sorry I can’t do it

what seemingly useless item can be of social, ecological or commercial value?

Answers

Earrings. They do nothing practical, but they provide social value by making you look more attractive.

Some seemingly useless item can be of social, ecological or commercial value is money, behavior, death etc.

What is something really useless?

A useless item are known to be things that are said to be rubbish.

They are items that is useless, of no value. Some  useless item can be of social, ecological or commercial value is money, behavior, vehicles etc.

Learn more about commercial value from

https://brainly.com/question/25528419

Which programming term describes the value that is passed to a method when called
so that the method knows what to do?
A parameter
An argument
A function
A variable

Answers

The programming term that describes the value that is passed to a method when called so that the method knows what to do is an Argument

What is an  Argument?

An argument in Programming are variables used to specify a value when you want to call a fuhnction which provides the programs utilizing more informathion.

A bettrer understanding is as follows:

create a function, pass in data in the form of an argumentProgram utilizes more information from the value of the argument.

For example

Say you want to create a function that describes how much money you're having; We can use artgument to descriptive as possible.

Before now, the function may have looked like:

string howMuchmoney() {

    return "so much money";

Modifying  the function prototype and implementation to take a string argument, it becomes

string howMuchmoney(string amount);

Change your return statement to:

return amount + "money";

Add a string to the parentheses where you call the function:

howMuchmoney("tons of")

Learn more in using Argument here:https://brainly.com/question/6067168

Identify three (3) general-purpose computing devices and write a short (no more
than one page) essay explaining in detail the computing process

Answers

The three (3) general-purpose computing devices used around the world are:

Desktop computersSmartphoneTablet

What is computing?

Computing refers to a process which involves the use of both computer hardware and software to manage, analyze, process, store and transmit data, so as to complete a goal-oriented task.

In Computer technology, a general-purpose computing device is a type of computer that can perform most common computing tasks when provided with the appropriate software application. Thus, three (3) general-purpose computing devices include the following:

Desktop computersSmartphoneTablet

Read more on computing here: https://brainly.com/question/19057393

Strategies of Green computing include:

Answers

Answer:

Equipment recycling, reduction of paper usage, virtualisation, cloud computing, power

The algorithm solves the problem
of size n by recursively solving
sub-problems of size n – 1, and
then combining the solutions in
Q(n) time.

Answers

Looking at the question on algorithm above, the correct answer is: [tex]O( {2}^{n} )[/tex]

What is algorithm?

Algorithm refers to a sequence of instructions that have been well-defined which helps to solve specific problems. Algorithm is used in computation.

The recurrence relation is:

T(n)=2.T(n-1)+c , n>0

T(n)=1, n=0.

Considering the back substitution method,

T(n) = 2kT(n-k)+ 2k-1c+....+20c

Substitute n-k=0

Therefore, we will have:

T(n) = 2nT(0)+ 2k-1c+....+20c

T(n) = [tex] {2}^{n - 1} + 1[/tex]

T(n) = [tex]O( {2}^{n} )[/tex]

Learn more about algorithm on https://brainly.com/question/24953880

[ASAP] Choose the tool that best matches each description.

___ is an open-source library that can be used to develop mobile apps in Python, where all of the objects look the same, no matter what platform it is displayed on. In contrast, the ___ library uses native objects, so that applications built with it will look like other apps on that platform.

1. Kivy
2. BeeWare​

Answers

BeeWare​  is an open-source library that can be used to develop mobile apps in Python, where all of the objects look the same, no matter what platform it is displayed on.

What is BeeWare used for?

Others re:

In contrast, the Kivy library uses native objects, so that applications built with it will look like other apps on that platform.

The BeeWare framework is known to be a kind of open-source network that is known to be a reliable Python program that helps  developer with some amount of tools that are used  for coding.

Based on the above,  BeeWare​  is an open-source library that can be used to develop mobile apps in Python, where all of the objects look the same, no matter what platform it is displayed on.

Learn more about library from

https://brainly.com/question/1348481

#SPJ1

Try it
Which phrases best describe plagiarism? Check all that apply.
presenting someone else's words as if they were your own
using someone else's idea without giving him or her credit
quoting and citing information as a reference or source
using an idea you found online and claiming it as your own
presenting your own original ideas

Answers

Answer:

Using Someone else's idea without giving him or her credit

Explanation:

In My Opinion

Answer:

124 :)

Explanation:

what is an example of fibre optic cable

Answers

Answer:

printing cable

Explanation:

is a cable used to transfer information from a computer to the printer in packages

9.3 code practice

Write a program that creates a 4 x 5 array called numbers. The elements in your array should all be random numbers between -30 and 30, inclusive. Then, print the array as a grid.

For instance, the 2 x 2 array [[1,2],[3,4]] as a grid could be printed as:

1 2
3 4
Sample Output
18 -18 10 0 -7
-20 0 17 29 -26
14 20 27 4 19
-14 12 -29 25 28
Note: the numbers generated in your program will not match the sample output, as they will be randomly generated.

pls help

Answers

The program is an illustration of arrays; Arrays are variables that are used to hold multiple values of the same data type

The main program

The program written in C++, where comments are used to explain each action is as follows:

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int main(){

   //This declares the array

   int myArray[4][5];

   //This seeds the time

   srand(time(NULL));

   //The following loop generates the array elements

   for(int i = 0; i< 4;i++){

       for(int j = 0; j< 5;j++){

       myArray[i][j] = rand()%(61)-30;

   }    

   }

   //The following loop prints the array elements as grid

   for(int i = 0; i< 4;i++){

       for(int j = 0; j< 5;j++){

       cout<<myArray[i][j]<<" ";

   }    

   cout<<"\n";

   }

   return 0;

}

Read more about arrays at:

https://brainly.com/question/22364342

6. Create lookup functions to complete the summary section. In cell I6, create a formula using the VLOOKUP function to display the number of hours worked in the selected week. Look up the week number in cell I5 in the range A17:G20, and return the value in the 2nd column. Use absolute references for cell I5 and the range A17:G20.

Answers

Answer:

Reporting period hours Timesheet Due Name 44260 Period Start 44228 Period End 40965 Summary Balances Date Completed 43722 Week # 1 Period Start Period End Worked

A team member who does not feel comfortable disagreeing with someones opinion in front of the team would most likely come from a

Answers

Answer:

discussions and decisions made about public policy

Explanation:

6. What are the arguments, pros and cons, for Python's use of indentation to specify compound statements in control statements

Answers

Answer:

[tex]beinggreat78~here~to~help.[/tex]

In some cases, one con is that it can be hard to keep track of your identation when coding long lines or blocks. The pro is that you may need to learn, which is not a bad thing. Learning is good.

why is this not working for my plus membership

Answers

Answer:

The overwhelming main cause for PlayStation Plus subscriptions not being recognised is because of PlayStation server maintenance which prevents your PS4 from communicating with Sony and discovering that you are a paid up PS Plus subscriber.

What is Word's default color for highlighting text?
O orange
O gray
O yellow
O blue

Answers

Answer:

Yellow.

Explanation:

Yellow is typically the color but you can always manually change it.

Answer:

yellow

Explanation:

On the home tab of the ribbon the default color for highlighting text and tool is yellow

what is computers machain?

Answers

Answer:

the electronic device which take data process it and give meaningful results is called computer machine

Develop a program to sort a file consisting of bonks details in the alphabetical order of author names. The details of books include book id, author_name, price. no of pages, publisher, year of publishing
Please provide C++ program for above question.​

Answers

Use the knowledge in computational language in C++ to write the a code with alphabetical order of author name.

How to define an array in C++?

An Array is a set of values ​​arranged in lists and accessible through a positive numeric index. So, we have that each position of our Array is a variable of the type of our Array, so we have to have a way to initialize this set of variables.

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

using namespace std;

struct Book {

   string title;

   string author;

};

const int ARRAY_SIZE = 1000;

Book books [ARRAY_SIZE];

string pathname;

ifstream library;

int LoadData();

void ShowAll(int count);

void ShowBooksByAuthor(int count, string name);

void ShowBooksByTitle(int count, string title);

void sortByTitle(int count, string title);

void sortByAuthor(int count, string author);

int main()

{  

   int count = 0;

   char selector = 'q', yesNoAnswer = 'n';

   string name;

   string title;

     cout << "Welcome to Forrest's Library Database." << endl;

   cout << "Please enter the name of the backup file: ";

   getline(cin, pathname);

   LoadData();

   count = LoadData();

   cout  << count << " records loaded successfully." << endl;

   do

   {

       cout << endl << "\t(S)how All, Search (A)uthor, Search (T)itle, (Q)uit: ";

       cin >> selector;

       selector = toupper(selector);

       switch(selector)

       {

           case 'S':

               sortByTitle(count, title);

               if (count <= 0)

                   cout << "No counts found!\n";

               else

                   ShowAll(count);

               break;

           case 'A':

               sortByAuthor(count, name);

               cout << "bookAuthor: ";

               cin.ignore();

               getline(cin, name);

               if (count <= 0)

                   cout << "No records found!\n";

               else

                   ShowBooksByAuthor(count, name);

               break;

           case 'T':

               sortByTitle(count, title);

               cout << "bookTitle: ";

               cin.ignore();

               getline(cin, title);

               if (count <= 0)

                   cout << "No records found!\n";

               else

                   ShowBooksByTitle(count, title);      

               break;

       }

   }

   while (selector != 'q' && selector != 'Q');

   return 0;

}

int LoadData()

{

   int count = 0;

   int i = 0;

   library.open(pathname);

   ifstream library(pathname);

   if (!library)

   {

       cout << "Cannot open backup file" << endl;

       return 0;

   }

   while (!library.eof())

   {

       getline(library, books[count].title);

       getline(library, books[count].author);

       count++;

   }

   return count;

}

void ShowAll(int count)

{

   for (int i = 0; i < count; i++)

   {

      cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

   }

}

void ShowBooksByAuthor(int count, string name)

{

   int j = 0;

   for (int i = 0; i < count; i++)

   {

       if(books[i].author.find(name) < 100)

       {

           cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

           j++;

       }

   }

   cout << j << " records found";}

void ShowBooksByTitle(int count, string title)

{

   int j = 0;

   for (int i = 0; i < count; i++)

   {

       if(books[i].title.find(title) < 100)

       {

           cout << books[i].title << " " << "(" << books[i].author << ")" << endl;

           j++;

       }

   }

   cout << j << " records found";

}

void sortByTitle(int count, string title) {

   string temp;

   for (int i = 0; i < count; i++) {

       for(int j = 0; j < count - i; j++) {

           if (books[j].title > books[j + 1].title) {

               temp = books[j].title;

               books[j].title = books[j + 1].title;

               books[j + 1].title = temp;

           }

       }

   }

}

void sortByAuthor(int count, string name) {

   string temp;

   for (int i = 0; i < count; i++) {

       for(int j = 0; j < count - i; j++) {

           if (books[j].author > books[j + 1].author) {

               temp = books[j].author;

               books[j].author = books[j + 1].author;

               books[j + 1].author = temp;

           }

       }

   }

}

See more about C++ at brainly.com/question/19705654

ICT4AD was meant to modernize the civil service through E-governance implementation.

Explain why you believe that this policy has achieved or not achieved this goal?

Answers

ICT4AD work through E-governance implementation fail as a result of:

Lack of Infrastructure. High cost of running its affairs as it needs  huge public expenditure. Issues with Privacy and Security and others.

What is the aim of e-governance?

The objectives of e-Governance is created so as to lower the level of corruption in the government and to make sure of  fast administration of services and information.

Conclusively, It is known to fail due to the reasons given above and if they are worked on, the service would have prospered.

Learn more about civil service from

https://brainly.com/question/605499



Computer A uses Stop and Wait ARQ to send packets to computer B. If the distance between A and B is 40000 km, the packet size is 5000 bytes and the
bandwidth is 10Mbps. Assume that the propagation speed is 2.4x108m/s
a) How long does it take computer A to receive acknowledgment for a packet?
b) How long does it take for computer A to send out a packet?

Answers

The time that it takes the computer to receive acknowledgment for a packet is 0.1667 seconds. The time it takes to send out a packet is  4 x 10⁻³seconds

1 The acknowledgment time for the packet

speed =  2.4x108m/s

Distance = 40000 km,

Time = distance/ speed

= 40000 x10³/ 2.4x10⁸m/s

= 0.1667

The time that it take is 0.1667 seconds.

b. Number of bytes = 5000

5000x 8 = 40000bits

10 mbps = 10000 kbps

10000 kbps = 10000000

packet size / bit rate = 40000/10000000

= 4 x 10⁻³seconds to send a packet out

Read more on computer bandwith here: https://brainly.com/question/27020560

PLS HELP In VPython, finish the code to draw a horizontal axis.

origin = vector (0, 0, 0)
axis = cylinder(pos=origin, axis=vector(________)

options are (50, 0, 0), (0, 50, 0) and (0, 0, 50)
its NOT (0, 50, 0)

Answers

Use the knowledge in computational language in python to write a code that draw a horizontal axis with vectors.

How to define vectors in Python?

In Python it is possible to define a vector with characters, forming a word, that is, a string of characters, which is abbreviated as "string". To do this, you can assign it as a constant or read the data as a word.

So in an easier way we have that the code is:

mybox = box(pos=vector(x0,y0,z0),

           axis=vector(a,b,c)

length=L,

height=H,

width=W,

up=vector(q,r,s))

See more about python at brainly.com/question/18502436

Sorry for being late, but the answer is...

50, 0, 0

PROOF:

A desktop is one kind of computer. Name two other kinds?​

Answers

Answer:

Notebook, supercomputer.

Explanation:

Notebooks are laptops, usually low performance.

Supercomputers are the best performing computers in the world.

Answer:

super computers and mainframe computers

Explanation:

these computers were used way before desktop computers

display unit is capable of displaying test but not ​

Answers

Answer:

I think your question must be display unit is capable of displaying text but not.

Explanation:

A text display is an electronic alphanumeric display device that is mainly or only capable of showing text, or extremely limited graphic characters.

what is the name of the extension used to save publisher

Answers

Answer:

PUB

Explanation:

PUB IS THE NAME OF THE EXTENSION USED TO SAVE PUBLISHER

Other Questions
439,532 written in verbal form I need 16,18, and 20 answered thank you what you (do)....... when i (come)....... to your office yesterday? Why is the understanding the earth structure important Find the value if x. PLS HELP ASAP Calculate the perimeter of the figure shown below.5 ft15 ft10 ft18 ft What were the economic consequences of apartheid in south africa? check all that apply. black citizens had a very low standard of living. wages remained low for most white citizens. black citizens could not own private property. the economy had a stagnant growth rate. the government had a low level of debt. PLS HELP OFFERING BRAINLIEST+20 POINTS! I RLLLLLLLLLYYYYYYY NEED HELP! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Which expression has a value of -22?5 2 128 (3) +33 (3)3 + (2) (8) 16 2 (15) How long is cooked steak good for in the refrigerator?. Solve the problem with more than one answer13-7+8= Can someone help me with this please :( Maria wrote the equation log (startfraction x over 2 endfraction) log (startfraction 20 over x squared endfraction) = log 8 what is the solution to marias equation? two ways ideas during the Renaissance were different from the Middle Ages. A shorter orbit around the Sun means _____.Question 2 options:A shorter dayA shorter yearFewer moons around the planet Mr. Jones is building the garage shown below. What is the volume of the garage? please answer of 6 of these but if you do then you get brainliest but answer all 6 and show the work on how to do it also for each problem HelpppFor triangle ABC below, find missing side length BC and both missing angle measures I work 4.5 hours I made $90.00 what did I make hourly