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
Veseljchak [2.6K]
3 years ago
10

def list_length(shrinking_list): ''' A recursive way to count the number of items in a list. ''' if shrinking_list

Computers and Technology
1 answer:
AnnZ [28]3 years ago
8 0

Answer:

Written in Python:

def list_length(shrinking_list):

    if not shrinking_list:

         return 0

    else:

         return list_length(shrinking_list[1:]) + len(shrinking_list[0])

Explanation:

This defines the list

def list_length(shrinking_list):

This checks if list is empty, if yes it returns 0

<em>     if not shrinking_list:</em>

<em>          return 0</em>

If list is not empty,

    else:

This calculates the length of the list, recursively

         return list_length(shrinking_list[1:]) + len(shrinking_list[0])

To call the function from the main, use:

<em>print(list_length(listname))</em>

You might be interested in
AUPs ensure that an organization’s network and internet are not abused. Select 3 options that describe AUPs.
tigry1 [53]

AUPs often involves not going onto unauthorized sites or downloading certain content, not using the service to violate any law, and not connecting to unauthorized devices through the network.

<h3>What is AUP?</h3>

AUP stands for Acceptable Use Policy, which refers to a policy that regulates users when they access a corporate newtork.

<h3>How does an AUP regulates users?</h3>

Most AUPs imply:

  • Users can only access certain sites and dowloading specific content is forbidden.
  • The access to the internet or network cannot be used for criminal purposes.
  • Only authorized users can connect to the corporate network.

Learn more about AUP in: brainly.com/question/9509517

#SPJ1

8 0
2 years ago
Write a function called add_tuples that takes three tuples, each with two values, and returns a single tuple with two values con
Leni [432]

In Python, tuples are indeed a data structure that also stores an ordered sequence of unchanging values, and following are the Python program to the given question:

Program Explanation:

  • Defining a method "add_tuples" that takes three variables "firstTuple, secondTuple, thirdTuple" into the parameter.
  • After accepting the parameter value a return keyword is used that adds a <em><u>single tuple with two values</u></em> and returns its value into the form of (x,y).
  • Outside the method, two print method is declared that calls the above method by passing value into its parameters.

Program:

def add_tuples(firstTuple, secondTuple, thirdTuple):#defining a method add_tuples that takes three variable in parameters

   return firstTuple[0]+secondTuple[0]+thirdTuple[0],firstTuple[1]+secondTuple[1]+thirdTuple[1] #using return keyword to add value

print(add_tuples((1,4), (8,3), (14,0)))#defining print method that calls add_tuples method takes value in parameters

print(add_tuples((3,2), (11,1), (-2,6)))#defining print method that calls add_tuples method takes value in parameters    

Output:

Please find the attached file.  

Learn more:

brainly.com/question/17079721

4 0
3 years ago
I just logged onto brainly and all my questions were deleted and i lost 2 brainliest. What has brainly done to my account I also
krok68 [10]
I’d say message Brainly directly through email!! it would be easier for them to help solve the issue since all we really can do is assume what happened, I hope you’re able to figure it out =)
5 0
3 years ago
Read 2 more answers
Which soft skills would these mobile app developers need to use in the situations described?
Ber [7]

Answer:

1: work ethic/presentation.

2: communication.

3: adaptability.

4: creativity.

(these are all guesses so i'm not 100% sure)

Explanation:

6 0
3 years ago
Read 2 more answers
All of the following are advantages of database-stored information, except: Question 3 options: 1) Reduced information redundanc
enot [183]

Answer:

3) Reduced information integrity.

Explanation:

This is not an advantage, Information integrity is a key factor when storing information on a database. As multiple users will access it, they will need this data to be authentic and dependable. Any reduction in information integrity is a great disadvantage.

5 0
3 years ago
Other questions:
  • When creating wireframe geometry and the autocursor is on what happens when you push the shift key?
    13·1 answer
  • What kind of problems could you run into if you format a cell with the wrong format for the data type?
    15·2 answers
  • Compare the specialized and statistical functions in excel
    10·1 answer
  • Methods can be ____ correctly by providing different parameter lists for methods with the same name.
    7·1 answer
  • When considering changing the content of a cell which button should you press to leave the cell as it originally was?
    13·2 answers
  • Using truth table, prove that:<br><br> (A + B). C = (A . C)+ (B .C) ?
    7·1 answer
  • write a pay-raise program that requests a person's first name, last name, and current annual salary, and then displays the perso
    6·1 answer
  • Write the issue related to the cyber ethnic. ​
    7·2 answers
  • What are the methods used in research methodology?
    12·1 answer
  • Private notes about individual slides that you leave for yourself or for others who might use the presentation file is called __
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!