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
Nezavi [6.7K]
2 years ago
13

Problem 8 - Recursive Divisible by 3 and 5 Complete the divBy3And5 function which accepts a list of integers. The function shoul

d recursively determine how many numbers in the list are divisible by 3 and how many are divisible by 5 and return these counts as a two-element tuple. Your solution MUST BE RECURSIVE and you MAY NOT USE LOOPS. You MAY NOT DEFINE A RECURSIVE HELPER FUNCTION.
Computers and Technology
1 answer:
slavikrds [6]2 years ago
5 0

The recursive function divBy3And5 is defined in Python and is found in the attached image.

In the base case, the function divBy3And5 tests if the input list is empty. If so, the tuple returned is (0, 0). This means no numbers are divisible by three and no numbers are divisible by five.

The recursive step gets the first element of the list and

  • If divisible by 3, it sets <em>count_of_3</em> to 1, else it leaves it as 0
  • If divisible by 5, it sets <em>count_of_5</em> to 1, else it leaves it as 0

It then makes a recursive call on the remaining elements, and stores it in a variable as follows

   <em>divBy3And5_for_remaining_elem</em> = divBy3And5(remaining_elements)

Then, it returns the tuple

       (<em>divBy3And5_for_remaining_elem</em>[0] + <em>count_of_3</em>,

                <em>divBy3And5_for_remaining_elem</em>[1] + <em>count_of_5)</em>

Learn more about recursion in Python: brainly.com/question/19295093

You might be interested in
Who plays Counter blox or counter strike
abruzzese [7]

Answer:

me

Explanation:

csgo

8 0
3 years ago
Read 2 more answers
What does altgr mean on a keyboard.
Setler [38]
AltGr (also Alt Graph) is a modifier key found on many computer keyboards (rather than a second Alt key found on US keyboards). It is primarily used to type characters that are not widely used in the territory where sold, such as foreign currency symbols, typographic marks and accented letters.
8 0
3 years ago
When following proper netiquetter rules you should follow all of the following rules except _____. Question 11 options: Don't us
vfiekz [6]

The answer is C. Use sarcasm and jokes in your e-mails to make the reader laugh


Sarcasm and jokes can be difficult to understand through text-based communication like e-mails, so it is best to avoid them altogether, especially in formal settings.

6 0
3 years ago
Read 2 more answers
Q#3. What are the advantages and disadvantages of Analog and Digital computers?​
Pie

Answer:

Advantages of Analog computers:

  • Many data parameters can be obtained concurrently in a simultaneous and real-time procedure.
  • Certain operations can be computed without the need of converters to transform the inputs and outputs to and from digital digital mode.
  • The developer must scale the problem for the computer's dynamic range during configuration. This might provide insight into the issue as well as the consequences of numerous faults.

Disadvantages of Analog computers:

  • Computer systems can handle greater issues for a certain efficiency and power usage.
  • Solution arise in real or delayed time, and recording them for subsequent use or investigation might be problematic.
  • The number of temporal variables that can be used is restricted. It's tough to correctly solve problems with elements that operate on radically various time periods.

Advantages of Digital computers:

  • It is a lot more efficient and more effective, particularly with today's computers, which can analyze information at a billion times the rate of a human.
  • Modern digital computers' incredible speed enables them to recreate objects in real time, resulting in new experiential characteristics of digital computers, such as interactive media.
  • It has the ability to convey information in a very brief manner. This enables data storage and transmission to be more efficient as digital systems are extremely dependable and controllable.

Disadvantages of Digital computers:

  • To complete the same tasks, digital computers need more power than analog computers, resulting in greater heat, which increases the complexity of the computer and necessitates the usage of heating elements.
  • To convey the same amount of data, digital computers require more capacity than analogue computers.
  • The detection of digital computers necessitates synchronization of the computer system, which is not always the scenario with analogue computers

5 0
2 years ago
what does it mean when the save button on the quick access toolbar changes to a circular set of two arrows?
elixir [45]

When the save button on the quick access toolbar changes to a circular set of two arrows, it means that workbook is saved in the cloud  (It means word is automatically syncing your changes back to OneDrive).

  • The Quick Access Toolbar (QAT) is simply known as small modifiable toolbar. It is often located at the top of the office application window that is, it can be seen next to the Microsoft Office button. It is known to have its own  set of independent commands and render quick access to commands like Save, Undo, Redo, etc.
  • OneDrive is a renown Microsoft cloud service and a type of cloud services that helps individuals to link up oneself to all our files. It allows storage and protection of  files, sharing and get to them any time.

Conclusively, we can say that When the save button on the quick access toolbar changes to a circular set of two arrows, it means that workbook is saved in the cloud  (It means word is automatically syncing your changes back to OneDrive).

Learn more from:

brainly.com/question/17163678

7 0
3 years ago
Other questions:
  • ____ uses markup to define the structure and layout of a web document.
    11·1 answer
  • Cover photos have a prominent location in your social media profiles, so you should use this space strategically – for example,
    14·1 answer
  • Piers wants to take a course on XML. He is a certified web designer, but he has not used XML before. How can he use XML to impro
    6·1 answer
  • 2. Use the Internet to research Robocopy switches and then construct a command line that will use Robocopy to copy files in rest
    14·1 answer
  • What will be the value of “sumtotal” when this code is executed?
    6·1 answer
  • WILL UPVOTE ALL
    10·1 answer
  • In the Microsoft Office Suite, what tells a database what to insert information in the document? 
    8·1 answer
  • Write an application program in C++ to implement a class Fibonacci to print Fibonacci series upto N using member function series
    9·1 answer
  • Which group scope can be used to assign permissions to resources only in the domain in which the group is created
    12·1 answer
  • Distributed databases and data warehouses would be considered which data model type?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!