Write a function swap that swaps the first and last elements of a list argument. Sample output with input: 'all,good,things,must,end,here'

Answers

Answer 1

Answer:

def swap(lst):

  lst = lst.split(",");

  temp = lst[0]

  lst[0] = lst[-1]

  lst[-1] = temp

 

  return lst

lst = input("Enter the list items: ")

print(swap(lst))

Explanation:

Create a function named swap that takes one parameter, lst

Since the input is entered as commas between values, we need to split the values using split() function

Set the temp as the first item in the lst

Update the first item as the last item

Update the last item as temp (Note that temp has the initial value of the first item)

Return the list

Ask the user to enter the items

Call the swap function passing the input as parameter and print

Answer 2

Answer:

def swap (values_list):

   values_list[0],values_list[-1]=values_list[-1],values_list[0]

   return values_list

Explanation:


Related Questions

Select the statements that are true regarding the future of technology. Select 2 options.
O Cloud computing has allowed smaller businesses to acquire the computing resources they need for less money
O Biocomputing uses computer components to simulate human thinking and problem-solving.
O Artificial intelligence uses biological components to retrieve, process, and store data, or are used to study biological organisms.
O Quantum computing has the potential to dramatically increase computing capabilities, but mass production is not likely to happen soon.
O Moore's Law describes computer industry growth caused solely by the miniaturization of transistors.

Answers

Answer:

Quantum computing has the potential to dramatically increase computing capabilities, but mass production is not likely to happen soon.  

Biocomputing uses computer components to simulate human thinking and problem-solving.

Explanation:

The true statement regarding the future of technology are:

B. Biocomputing uses computer components to simulate human thinking and problem-solving.

D. Quantum computing has the potential to dramatically increase computing capabilities, but mass production is not likely to happen soon.

What is technology?

Technology is the new inventions based on the skills and knowledge. The methods and process are used in a way that produce a new technology or equipment that makes the life easier.

Quantum computing is a branch of computing that clear the phenomenon of quantum like superposition, interference, and entanglement.

Thus, the correct options are: B. Biocomputing simulates human thought and problem-solving by using computer components.

D. Although mass production of quantum computing equipment is unlikely to materialize very soon, it has the potential to significantly enhance computing power.

To learn more about technology, refer to the link:

https://brainly.com/question/9171028

#SPJ5

pls help me i reallt need help

Answers

Answer:

Long-form work

which of the following is 1000 of a second​

Answers

Answer:

what I don't understand your question

Jeff took a picture of his dog that he wants to include in his paper titled "Rescue Dogs of Florida." What tab should Jeff choose to place the picture in his document? (5 points)
Home

Answers

Answer:

Insert (B for me at least)

Explanation:

its insert because if you click on the tab it says you can add a picture and I got it right on my test

Answer:

B) Insert tab

Explanation:

Use the insert tab then click pictures and insert any pictures you want.

Computer Architecture

Answers

Answer: computer architecture is a set of rules and methods that describe the functionality, organization, and implementation of computer systems. ... In other definitions computer architecture involves instruction set architecture design, microarchitecture design, logic design, and implementation. e.g Computer architecture consists of three main categories. System design – This includes all the hardware parts, such as CPU, data processors, multiprocessors, memory controllers and direct memory access. This part is the actual computer system.

Explanation:

The first known permanent photograph was called "View from the Window at Le Gras." True False

Answers

Answer:

TRUE

Explanation:

I did the K12 test :)Hope this helps

Answer:

true

Explanation:

Write a function called double_list that accepts a list of strings as a parameter and returns a new list that replaces every string with two of that same string. For example, if the list has the values ['how', 'are', 'you?'], the function should return the list with the values ['how', 'how', 'are', 'are', 'you?', 'you?'].
original list: ['how', 'are', 'you?']
double list: ['how', 'how', 'are', 'are', 'you?', 'you?']

Answers

Answer:

They are called server ancillaries

Explanation:

What does software alone enable a computer to do? connect to the Internet control processing speeds interact with the user manage other software

Answers

Software alone enables a computer to manage other software. Thus, option D is correct.

What is a computer?

A device that could keep and analyze material is a computer. One can easily maintain many purposes and functions that will be manually not possible but computers make them easy to operate.

A bundle of information, commands, and applications known as "software" are utilized by computing to operate as well as carry out particular activities that acquire the technical expertise required for selecting, implementing, managing, and scaling data and technology infrastructure.

Softwares were necessary for hardware to function. In actuality, software communication seems to be what enables the microcomputer to function.

Therefore, option D is the correct option.

Learn more about computer, here:

https://brainly.com/question/13805692

#SPJ2

Which is equal?
1 KB = 2,000 Bytes
1 MB » 1,000 KB
3 GB = 5,000,000 KB
O 8 TB = 7,000 MB
4 PB - 2,500,000 GB

PLEASE HELP 10points

Answers

Answer:

1 mb = 1000 kb

all others are wrong although it's 1024 KB that's makes 1 mb but the value can be approximated

Complete the sentence.
_______is a career discipline that focuses on developing new computing technologies and techniques.
O computer science
O information technology
O computer technology
O information systems

Answers

Answer:

Computer Science

Explanation:

These other options deal with different disciplines of computers. Information technology deals with the collecting and storing of data. Computer technology deals with the maintenance and work of a computer system. Information systems deals with the way that you can collect and store data.

,Computer Science_is a career discipline that focuses on developing new computing technologies and techniques. Hence, option A is correct.

What is tech support?

Tech support has been the acronym for technological support. A company has been requiring the backend support that helps in resolving the issues related to the technical products.

We know that Computer technology deals with the maintenance and work of a computer system.

The Information systems deals with the way that you can collect and store data.

These other options deal with different disciplines of computers, thus  Information technology deals with the collecting and storing of data.

The education discipline helps in providing a company with technological support has been information technology.

Thus,Computer Science_is a career discipline that focuses on developing new computing technologies and techniques. Hence, option A is correct.

Learn more about tech support, here:

brainly.com/question/21415070

#SPJ2

I need to write a program, using getline and copy (which we were given via the textbook) that takes in multiple lines of random letters, and outputs how many unique letters are in the line (upper and lowercase count the same).

This was my attempt at that but it doesnt provide any output. What am I doing wrong?

(This is in C programming)​

Answers

Answer:

OK

Explanation:

OK

Which group and tab do you need to be in to separate text into two columns? Paragraph group and Insert tab Page Layout group and Home tab Page Setup group and Page Layout tab Home group and Page Setup tab

Answers

Answer: Page setup group and page layout tab

Explanation:

:)

Answer:

Page setup group and page layout tab

Explanation:

just answered the question

Romans are credited with “inventing” the capital city l? T or F

Answers

Answer:

T

Explanation:

just finished the assignment on edge

PLEASE HURRY!!!
What is the output of the following program? Assume numA is 4, numB is 2, and numC is 6.

if numA < numB and numB < numC:
print(numA)
elif numB < numA and numB < numC:
print(numB)
else:
print(numC)

A) 2.0
B) numA
C) 4.0
D) numB

Answers

Answer: 2.0

Explanation: I did this on ed genuity , I’m terrible at this so I don’t really have an explanation

Answer:

A)2.0

Explanation:

You are probably inputting this into the wrong section of python. Most beginners of python(Including me) start out by going into a new untitled blank coding slate. This type of code isn't meant to go into the coding slate. This is meant to go into the python shell. Therefore if you put this into the coding slate, you won't get back a result at all because half of your functions are rendered useless.

What will the operator 1 AND 1 return ?

Answers

When you perform a & 1 it will always return 0 or 1 depending upon the the last binary digit of a.

The operator 1 AND 1 return will be Basic Binary Math" module for a refresher as CIDR simplifies how routers and different community gadgets want to consider the elements of an IP address.

What is the operator ?

In arithmetic and on occasion in pc programming, an operator is an individual that represents an action, as for instance, x is a mathematics operator that represents multiplication.

The 1 and 1 return 1 if the least good sized little bit of x is 1 else zero . 1 & 1 = 1 , zero & 1 = zero . That's how the operator is defined. Any bit besides the ultimate one is zero due to the fact it is zero in 1.

Read more about operator:

https://brainly.com/question/25974538

#SPJ2

A 'array palindrome' is an array which, when its elements are reversed, remains the same (i.e., the elements of the array are same when scanned forward or backward) Write a recursive, boolean-valued method, isPalindrome, that accepts an integer-valued array, and a pair of integers representing the starting and ending indexes of the portion of the array to be tested for being a palindrome. The function returns whether that portion of the array is a palindrome. An array is a palindrome if: the array is empty (0 elements) or contains only one element (which therefore is the same when reversed), or the first and last elements of the array are the same, and the rest of the array (i.e., the second through next-to-last elements) form a palindrome.

Answers

Answer:

Here is the JAVA program:

class Main {    

static boolean isPalindrome(int array[], int starting, int ending) {  /*a boolean method that takes an integer-valued array, and a pair of integers representing the starting and ending indexes of the portion of the array to be tested for being a palindrome */

   if (starting >= ending) {  //base case

       return true;     }  //returns true

   if (array[starting] == array[ending]) {  //recursive case

       return isPalindrome(array, starting + 1, ending - 1);     }  //calls isPalindrome recursively to find out palindrome

   else {  

       return false;    }  }  //returns false if array is not palindrome

 

   public static void main (String[] args) {  //start of main function

   int array[] = { 1,2,3,2,1};  //creates an array

   int size = array.length;   //computes the size of array

 System.out.print(isPalindrome(array, 0, size - 1));    } } //calls method to test array for being  a palindrome

Explanation:

The program works as follows:

array = { 1,2,3,2,1}

starting = 0

ending = size-1 = 5-1 = 4

if (starting >= ending) condition evaluates to false because starting i.e. 0 is not greater or equal to ending i.e. 4. So the program moves to the next if part

if (array[starting] == array[ending])

This becomes:

if (array[0] == array[4])

The element at 0th index is the first element of the array i.e. 1 and the element at 4th index of array is the last element of array i.e. 1. So both these elements are equal so the following statement executes:

return isPalindrome(array, starting + 1, ending - 1);

Now the starting and ending become:

starting+1 = 0+1 = 1

ending-1 = 3

if (starting >= ending) base condition evaluates to false because starting  is not greater or equal to ending. So the program moves to the next if part

if (array[starting] == array[ending])

This becomes:

if (array[1] == array[3])

The element at 1st index is 2 and the element at 3rd index of array is 2. So both these elements are equal so the following statement executes:

return isPalindrome(array, starting + 1, ending - 1);

Now the starting and ending become:

starting+1 = 1+1 = 2

ending-1 = 2

if (starting >= ending) base condition evaluates to true because starting  is  equal to ending. So the following statement executes:

       return true;    

This means the function returns true and this shows that array is a palindrome.

The screenshot of the program and its output is attached.

Write a C program with a user defined function myFactorial, that calculates the factorial of a number entered by the user. Return the calculated factorial and print it in the main function.

Answers

Answer:

Written in C

#include <stdio.h>

int myFactorial(int n){

   int fact = 1;

   for (int k = 1; k<=n;k++)

   {

       fact*=k;

   }

   return fact;

}

int main() {

   int num;

   printf("Number: ");

   scanf("%d",&num);

   if(num>=0)    {

       printf("%d",myFactorial(num));

   }

   return 0;

}

Explanation:

I've added the full program as an attachment where I used comments to explain some lines

Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 Find the smallest value, and then subtract it from all three values, thus removing the gray.Note: This page converts rgb values into colors.
the answer:
#include
using namespace std;
int main() {
int red;
int green;
int blue;
cin >> red >> green >> blue;
if ((red <= green) && (red <= blue)) {
cout << red;
}
else if ((green <= red) && (green <= blue)) {
cout << green;
}
else {
cout << blue;
}
return 0;
}

Answers

Answer:

Follows are the code to this question:

#include<iostream>//defining header file

using namespace std;// use package

int main()//main method

{

int red,green,blue,x;//declaring integer variable

cin>> red >>green>>blue;//use input method to input value

if(red<green && red<blue)//defining if block that check red value is greater then green and blue  

{

x = red;//use x variable to store red value

}

else if(green<blue)//defining else if block that check green value greater then blue  

{

x= green; //use x variable to store green value

}

else//defining else block

{

x=blue;//use x variable to store blue value

}

red -= x;//subtract input integer value from x  

green -=x; //subtract input integer value from x

blue -= x;//subtract input integer value from x

cout<<red<<" "<<green<<" "<<blue;//print value

return 0;

}

Output:

130 50 130

80 0 80

Explanation:

In the given code, inside the main method, four integers "red, green, blue, and x" are defined, in which "red, green, and blue" is used for input the value from the user end. In the next step, a conditional statement is used, in the if block, it checks red variable value is greater than then "green and blue" variable. If the condition is true, it will store red variable value in "x", otherwise, it will goto else if block.

In this block, it checks the green variable value greater than the blue variable value. if the condition is true it will store the green variable value in x variable.In the next step, else block is defined, that store blue variable value in x variable, at the last step input variable, is used that subtracts the value from x and print its value.      

Choose the type of error that matches the described situation.

(blank) : Results of program are returned but they are not correct because the computation was designed incorrectly.


(blank) : Error caused by incorrect indentation of a line.


(blank) : Error caused by trying to open a file that cannot be found.

Answers

The type of error that matches the described situations are;

1) Logic Error

2) Syntax Error

3) Exceptions

1) Results of program are returned but they are not correct because the computation was designed incorrectly; This will be classified as a logic error because a logic error in computer programming is one in which it occurs when there is a bug/mistake in  computer program that makes it give incorrect results/behavior but it doesn't make it to crash or terminate abruptly.

2) Error caused by incorrect indentation of a line; This type of error is called a syntax error because it involves mistake in the use of language. In this case, there is a wrong language in indentation of the line.

3)  Error caused by trying to open a file that cannot be found; This type of error is an exception because it is an error that can be recovered even while running the program.

Read more at; https://brainly.in/question/12894870

Submit your three to five page report on three manufacturing careers that interest you.

Answers

Answer:

Manufacturing jobs are those that create new products directly from either raw materials or components. These jobs are found in a factory, plant, or mill. They can also exist in a home, as long as products, not services, are created.1

For example, bakeries, candy stores, and custom tailors are considered manufacturing because they create products out of components. On the other hand, book publishing, logging, and mining are not considered manufacturing because they don't change the good into a new product.

Construction is in its own category and is not considered manufacturing. New home builders are construction companies that build single-family homes.2 New home construction and the commercial real estate construction industry are significant components of gross domestic product.3

Statistics

There are 12.839 million Americans in manufacturing jobs as of March 2020, the National Association of Manufacturers reported from the Bureau of Labor Statistics.4 In 2018, they earned $87,185 a year each. This included pay and benefits. That's 21 percent more than the average worker, who earned $68,782 annually.5

U.S. manufacturing workers deserve this pay. They are the most productive in the world.6 That's due to increased use of computers and robotics.7 They also reduced the number of jobs by replacing workers.8

Yet, 89 percent of manufacturers are leaving jobs unfilled. They can't find qualified applicants, according to a 2018 Deloitte Institute report. The skills gap could leave 2.4 million vacant jobs between 2018 and 2028. That could cost the industry $2.5 trillion by 2028.

Manufacturers also face 2.69 million jobs to be vacated by retirees. Another 1.96 million are opening up due to growth in the industry. The Deloitte report found that manufacturers need to fill 4.6 million jobs between 2018 and 2028.9

Types of Manufacturing Jobs

The Census divides manufacturing industries into many sectors.10 Here's a summary:

Food, Beverage, and Tobacco

Textiles, Leather, and Apparel

Wood, Paper, and Printing

Petroleum, Coal, Chemicals, Plastics, and Rubber

Nonmetallic Mineral

Primary Metal, Fabricated Metal, and Machinery

Computer and Electronics

Electrical Equipment, Appliances, and Components

Transportation

Furniture

Miscellaneous Manufacturing

If you want details about any of the industries, go to the Manufacturing Index. It will tell you more about the sector, including trends and prices in the industry. You'll also find statistics about the workforce itself, including fatalities, injuries, and illnesses.

A second resource is the Bureau of Labor Statistics. It provides a guide to the types of jobs that are in these industries. Here's a quick list:

Assemblers and Fabricators

Bakers

Dental Laboratory Technicians

Food Processing Occupations

Food Processing Operators

Jewelers and Precious Stone and Metal Workers

Machinists and Tool and Die

Medical Appliance Technicians

Metal and Plastic Machine Workers

Ophthalmic Laboratory Technicians

Painting and Coating Workers

Power Plant Operators

Printing

Quality Control

Semiconductor Processors

Sewers and Tailors

Slaughterers and Meat Packers

Stationary Engineers and Boiler Operators

Upholsterers

Water and Wastewater Treatment

Welders, Cutters, Solderers

Woodworkers11

The Bureau of Labor Statistics describes what these jobs are like, how much education or training is needed, and the salary level. It also will tell you what it's like to work in the occupation, how many there are, and whether it's a growing field. You can also find what particular skills are used, whether specific certification is required, and how to get the training needed.11 This guide can be found at Production Occupations.

Trends in Manufacturing Jobs

Manufacturing processes are changing, and so are the job skills that are needed. Manufacturers are always searching for more cost-effective ways of producing their goods. That's why, even though the number of jobs is projected to decline, the jobs that remain are likely to be higher paid. But they will require education and training to acquire the skills needed.

That's for two reasons. First, the demand for manufactured products is growing from emerging markets like India and China. McKinsey & Company estimated that this could almost triple to $30 trillion by 2025. These countries would demand 70 percent of global manufactured goods.12

How will this demand change manufacturing jobs? Companies will have to offer products specific to the needs of these very diverse markets. As a result, customer service jobs will become more important to manufacturers.

Second, manufacturers are adopting very sophisticated technology to both meet these specialized needs and to lower costs.

Plz answer me will mark as brainliest picture included ​

Answers

Answer:

Adc

Explanation:

A colleague asks you to research a CPU for a new server that will run Windows Server 2019. He explains the server roles that he intends to install and says that the CPU must support Nested Page Table . What is your colleague most likely planning to install on the server ?
a. it doesn’t support AMD processors
b. You can upgrade from Windows Server 2008 x86
c. you can upgrade from Server Core to Server with a GUI
d. you can’t upgrade to a different language

Answers

Answer:

a

Explanation:

just gesing

Time mangement is primarily the act of using time

Answers

yeah and knowing how to manage it correctly

Write a program that asks for the user's first, middle, and last name as one input. The names must be stored in three different character arrays. The program should then store in a fourth array the name arranged in the following manner: the last name followed by a comma and a space, followed by the first name and a space, followed by the first initial of the middle name and a period. Display the contents of the fourth array on the screen. No standard strings can be used. Oh I'm so mean.
Sample input:
Neil Patrick Harris
Output:
Harris, Neil P.

Answers

Answer:

Here is the C++ program:

#include <iostream>  //to use input output functions  

#include <cstring>  // used to manipulate c strings  

using namespace std;  //to identify objects cin cout

const int SIZE = 20;  //fixes constant size for firstName, middleName and lastName arrays  

const int FULL_SIZE = 60;  //constant size for fullName array  

int main() {  //start of main method  

 char firstName[SIZE]; //declares a char type array to hold first name  

 char middleName[SIZE];//declares a char type array to hold middle name  

 char lastName[SIZE]; //declares a char type array to hold last name  

 char fullName[FULL_SIZE]; //declares a char type array to hold full name

 cout << "Enter first, middle, and last name:  ";  //prompts user to enter first name

 cin>>firstName>>middleName>>lastName;  //reads last name from user, stores it in lastName array

 strcpy(fullName, lastName);  //copies last name from lastName to fullName array using strcpy method which copies a character string from source to destination

 strcat(fullName, ", "); //appends comma "," and empty space " " after last name in fullName using strcat method which appends a string at the end of another string

 strcat(fullName, firstName);  //appends first name stored in firstName to the last of fullName

 strcat(fullName, " ");  //appends an empty space to fullName

  char temp[2];  //creates a temporary array to hold first initial of middle name

temp[0] = middleName[0];  //holds the first initial of middle name

strcat(fullName, temp);  //appends first initial of middle name stored in temp to the last of fullName

strcat(fullName, ".");   //appends period

    cout<<fullName;  } //displays full name

Explanation:

I will explain the program with an example

Lets say user enters Neil as first name, Patrick as middle and Harris as last name. So firstName char array contains Neil, middleName char array contains Patrick and lastName char array contains Harris.  

Next the fullName array is declared to store Neil Patrick Harris in a specific format:

strcpy(fullName, lastName);

This copies lastName to fullName which means fullName now contains Harris.

 strcat(fullName, ", ");

This appends comma and an empty space to fullName which means fullName now contains Harris with a comma and empty space i.e. Harris,

strcat(fullName, firstName);

This appends firstName to fullName which means Neil is appended to fullName which now contains Harris, Neil

 strcat(fullName, " ");  

This appends an empty space to fullName which means fullName now contains Harris, Neil with an empty space i.e. Harris, Neil

char temp[2];

temp[0] = middleName[0];

This creates an array to hold the first initial of middle name i.e. P of Patrick

strcat(fullName, temp);

This appends an the first initial of middleName to fullName which means fullName now contains Harris, Neil P

strcat(fullName, ".");

This appends a period to fullName which means fullName now contains Harris, Neil P.

Now    cout <<"Full name is:\n"<<fullName<< endl; prints the fullName so the output of this entire program is:

Full name is:                                                                                                                                  Harris, Neil P.

The screenshot of the program along with its output is attached.

Which of the following is an example of self-directed learning?

attending required training classes

reading informative articles about computers

attending college

getting a second degree

Answers

Answer:

reading informative articles about computers , self directed learning means YOU directed the education

Reading informative articles about computers would be your best choice

text in a cell can be algined as dash​

Answers

Answer:

Text and numbers can be aligned to the left, right or center of a cell, as well as to the top, middle and bottom.

The Footnote Text style defines characters as ____________.

Question 2 options:

12 point Times New Roman and paragraphs as single-spaced and right aligned


10 point Times New Roman and paragraphs as double-spaced and left-aligned


12 point Times New Roman and paragraphs as double-spaced and right-aligned


10 point Times New Roman and paragraphs as single-spaced and left-aligned

Answers

Answer:

D 10 point Times New Roman and paragraphs as single-spaced and left-aligned

Suppose stuff is a three-dimensional jagged array of integers such that each row may have a different number of columns. Using an index-based approach, fill in the missing parts of the following code, which should print the sum of any odd integers located in odd-indexed cells in the array. (Odd-indexed means that every index associated with a particular cell is an odd integer.) You may assume that the each dimension contains at least two values. Be certain to make your solution as efficient as possible; don't do work that doesn't contribute to the answer.total=for g in ____:for t in_____:for h in ____:if _____:total= ______________

Answers

Answer:

this is python Suppose stuff

Explanation: easy

#Last exercise, you wrote a function called#one_dimensional_booleans that performed some reasoning#over a one-dimensional list of boolean values. Now,#let's extend that.##Imagine you have a two-dimensional list of booleans,#like this one:#[[True, True, True], [True, False, True], [False, False, False]]##Notice the two sets of brackets: this is a list of lists.#We'll call the big list the superlist and each smaller#list a sublist.##Write a function called two_dimensional_booleans that#does the same thing as one_dimensonal_booleans. It should#look at each sublist in the superlist, test it for the#given operator, and then return a list of the results.##For example, if the list above was called a_superlist,#then we'd see these results:## two_dimensional_booleans(a_superlist, True) -> [True, False, False]# two_dimensional_booleans(a_superlist, False) -> [True, True, False]##When use_and is True, then only the first sublist gets#a value of True. When use_and is False, then the first#and second sublists get values of True in the final#list.##Hint: This problem can be extremely difficult or#extremely simple. Try to use your answer or our#code from the sample answer in the previous problem --#it can make your work a lot easier! You may even want#to use multiple functions.#Write your function here!def two_dimensional_booleans(bool_superlist, use_and):length_of_super_bool_list = len(bool_superlist)if use_and is False:for bool_sub_list in bool_superlist:result = []false_count = 0for num in bool_sub_list:if num is False:false_count += 1else:passif false_count == len(bool_sub_list):result.append(False)else:result.append(True)result = result[0:length_of_super_bool_list]return resultelif use_and is True:result = []for bool_sub_list in bool_superlist:true_count = 0for num in bool_sub_list:if num is True:true_count += 1else:passif true_count == len(bool_sub_list):result.append(True)else:result.append(False)result = result[0:length_of_super_bool_list]return result#Below are some lines of code that will test your function.#You can change the value of the variable(s) to test your#function with different inputs.##If your function works correctly, this will originally#print:#[True, False, False]#[True, True, False]bool_superlist = [[True, True, True], [True, False, True], [False, False, False]]print(two_dimensional_booleans(bool_superlist, True))print(two_dimensional_booleans(bool_superlist, False))

Answers

Answer:

def one_dimensional_booleans(bool_list, use_and):

   if not use_and:

       return True in bool_list

   else:

       return not False in bool_list

def two_dimensional_booleans(bool_superlist, use_and):

   bool_values = []

   for bool_sublist in bool_superlist:

       bool_values.append(one_dimensional_booleans(bool_sublist,use_and))

   return bool_values

Explanation:

Simple clean approach is to use 2 functions and since function one does all the work..we will use it inside a for loop running under function two..so what we need to do is define the 1.#two dimensional booleans function 2.#initialize an empty list where we will append the values read from each bool_sublist in the bool superlist.

Following are the python code for the given question:

Python Program:

def  one_dimensional_booleans(bool_list,use_and):#defining a method one_dimensional_booleans that takes two variable inside the parameter

   if use_and==True:#defining if block that checks use_and variable value equal to True

       for i in bool_list:#defining for loop that holds bool_list value

           if i==False:#defining if block that check i value equal to False

               return False#return value False

       return True#return value True

   else:#defining else block

       for i in bool_list:#defining loop that use i variable to holds bool_list value

           if i==True:#defining if block that check i value equal to True

               return True#return value True

       return False#return value False

print(one_dimensional_booleans([True,True,True],True))#calling method one_dimensional_booleans and print its return value

print(one_dimensional_booleans([True,False,True],True))#calling method one_dimensional_booleans and print its return value

print(one_dimensional_booleans([True,False,True],False))#calling method one_dimensional_booleans and print its return value

print(one_dimensional_booleans([False,False,False],False))#calling method one_dimensional_booleans and print its return value

Output:

Please find the attached file.

Program Explanation:

Defining a method "one_dimensional_booleans" that takes two variables inside the parameter that is "bool_list,use_and".In this first variable that is "bool_list" is a list type and the second "use_and" is a bool type variable.Inside the method and if block is defined, that checks the "use_and" variable value equal to True, inside this, a for loop is used that holds the bool_list value.Inside the loop, and if a block is used that checks "i" value equal to False if it's true it will return value False, otherwise return value True.In the next step, else block is defined, inside this a loop is used that uses "i" variable to holds bool_list value, and inside this, if block checks "i" value equal to True.It will return the value True otherwise return the value False.Outside the method "one_dimensional_booleans" is called that prints its return values.

Please find the complete code in the attached file.

Find out the more about the code here:

brainly.com/question/18089222

Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be changed once they are defined.

Answers

Answer:

B :)

Explanation:

Arrays are described as immutable because they are arranged sequentially.

What are arrays?

Arrays is the collection of similar data items stored at different memory locations. It is the type of the simplest data structure where each data element can be accessed directly by only using its index number.

Thus, Arrays are described as immutable because they are arranged sequentially.

Learn more about arrays.

https://brainly.com/question/19570024

#SPJ2

Other Questions
What are characteristics of black codes 6 times a number increased by 3 is 27 find the number and solve it 1. Why should persons accused of crimes beinformed of their rights when they arearrested? write a paragraph why u should become a class leader I dont know who needs to hear this.... but you're worth it:))Dont give up, somebody needs you A 21 foot tower must be secured with a wire anchored 7 feet from the base of the tower. What angle will the wire make with the ground? Round your answer to the nearest tenth. A line passes through the points (4, -1) and (2, 3). What is the slope of the line? Good mental health is the ability to __________. A. express feelings appropriately B. allow daily situations to cause excessive anxiety C. to recognize and cope with the daily demands of life D. None of the above 13. Based on the type of elements in the compound, are there ionic or covalent?a. KCIb. NO2C. Caod AIF3e. HFf. NBr3g. MgBr2 y = -2 x2 + 8x - 5Find the vertex(minimum or maximum) ,the equation of the axis of symmetry,the y-intercept,the domain and range,and then graph the function by making a table .Label the graph with all the information you were asked to find. hellppp meeeeee...... Can someone plz write a summary about this while i do 50 other assignments I will give brainliestSunday at the Water ParkYeah, the job is pretty boring, Mariah admitted, looking at the wave pool from atop her lifeguard station. But I get to be outdoors and I can go on all the rides for free when Im done.Her questionerBerry, a classmate she didnt know well, who happened to be a customer as well as being the annoying editor of the school newspaperstretched his arm up toward her in some weird kind of salute. Actually he was recording her with the purple-and-black striped phone in his hand. How are the working conditions? he inquired in the important tones of an anchorman. Theyre She stopped cold. She stood up, staring at the crowd who rose and fell and squealed with each new surge of machine-churned water. Amid the bobbing figures, she had seen one stop moving, and seen its head sink halfway under the water and stay there.She grabbed the rescue tube and dove into the pool. In what felt like an instant, she had swum to the far end, a few feet from the wave machine, and stopped behind the eight-year-old boy who was floating face-down. She thrust the long, red foam rescue tube at him. Then, she stood in the three-foot deep water and scooped him around the waist. As she lifted his head, a waterfall of clear, bubbly water streamed down. She wrapped both his small, soft hands around the flotation tube and towed him to the side of the pool. She hoisted him high and set him on the brightly painted white cement, then boosted herself up after him.The boyhis name turned out to be Peterhadnt fully lost consciousness, so he didnt need CPR. After a couple of slaps on the back, he was coughing wetly and breathing well, though too stunned even to ask what had happened. By now, the waders in the pool understood vaguely what had happened. They looked around helplessly and asked each other bewildered questions. No one had noticed that Peter was drowning, not even the adults three feet away from him. Peters teenage brother and his friends had sloshed as quickly as they could to poolside. In five minutes, the EMS ambulance arrived to take Peter to the nearby clinic.I got it all on video! Berry exclaimed. Now give me an interview! She couldnt give him much of an interview, because the event had lasted only thirty seconds. She hadnt consciously decided how to act, and didnt remember many details. Her reflexes had done it all automatically. Her lifesaving courses had worked!She hardly knew what she was saying during the interview, and assumed she must sound incredibly dumb and out of breath. Later her family and neighbors told her how poised and in-charge shed appeared. The strange thing was, she didnt feel as if shed done anything special. The only thing that felt new was the way she couldnt keep herself from smiling at everythingat the trees in her backyard, at silly TV shows, at her younger brother, at the table setting at dinner, at everything. Does this polynomial have a GCF greater than 1? which feature is often used to define an era What force is jumping on a trampoline a push or a pull Is the following statement a biconditional?If Maura is going to the library, then she is bringing her favorite binder.yesno Observe very carefully the following art piece, and answer whether or not you think isbalanced.Edgar Degas, The Rehearsal, 1877NoYes Please select the word from the list that best fits the definition.Describing the size of the Grand Canyon. Visualization or Categorization? "The first rays of morning tiptoed through the meadow." What is being personified in that sentence? The morningThe meadowTiptoedThe first rays of morning HAS ANYONE READ THE SHORT STORY 'My Favorite Chaperone' By Jean Davies Okimoto?If you have read the whole story before, do you know what the genre of the story is?What is the genre of the story 'My Favorite Chaperone'?Thank you.