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
Tema [17]
4 years ago
13

#Write a function called one_dimensional_booleans.

Computers and Technology
1 answer:
deff fn [24]4 years ago
5 0

Answer:

def one_dimensional_booleans(bool_list, use_and):

   

   is_all_true = True

   is_one_true = False

   

   if use_and:

       for b in bool_list:

           if b == False:

               is_all_true = False

               break

   

       if is_all_true:

           return True

       else:

           return False

   

   else:

       for b in bool_list:

           if b == True:

               is_one_true = True

               break

   

       if is_one_true:

           return True

       else:

           return False

Explanation:

Create a function named one_dimensional_booleans that takes two parameters, bool_list and use_and

Inside the function:

Set is_all_true as True and is_one_true as False. These will be used to check the list

If use_and is True, check each item in the bool_list. If one item is False, set the is_all_true as False and stop the loop. This implies that the list contains a False value. Then check the is_all_true. If it is True, return True. Otherwise, return False.

If use_and is False, check each item in the bool_list. If one item is True, set the is_one_true as True and stop the loop. This implies that the list contains a True value. Then check the is_one_true. If it is True, return True. Otherwise, return False.

You might be interested in
Which shooting games is good for low end PC. CSGO or Valorant?​
aleksandr82 [10.1K]

the best choice would be csgo

6 0
3 years ago
i need help or good site for my project topic: identification of problems hindering effective teaching and learning of computer
attashe74 [19]

Answer:

they learn how to be independent

and how to create their website at the young age and who make money and create jods

like me I'm learning IT at katlehong secondary school

and I'm now to create my website

4 0
3 years ago
Which of the following statements is true?
jeka57 [31]

Answer: Constructors can specify parameters but not return types.

Explanation:

public class Student {

 int roll_no;

 public Student(int a) {

   roll_no = a;

 }

public static void main(String[] args) {

   Student abs = new Student(10);

   System.out.println(abc.roll_no);

 }

}

In the above code we have illustrated the working of constructors. We have a class with the name Student. then a constructor is created of the class called as the class constructor. In the main we create an object of the class and with this object we invoke the constructor and also pass a parameter. Here in the code we are passing the roll no of the student.

So we can say that constructor is called during the runtime when the object created invokes the constructor so a constructor can have many arguments but it does not have a return type.

7 0
3 years ago
Is GLaDOS from portal 2 possible?
77julia77 [94]

Answer:

Explanation:Yes Glados 2 is posible.

8 0
4 years ago
Which character is cannot be used in a file name _ (underscore)/ (backslash)- (hyphen) % ( percent)
Crazy boy [7]
In Windows a (real) backslash is a path separator. The % is involved with DOS variables.
4 0
3 years ago
Other questions:
  • Which is true about POP3 and IMAP for incoming email?
    6·1 answer
  • An intranet is a way for a company or organization to protect copyrighted and other important information?
    15·2 answers
  • ?trophic levelNYIGVU.;/IO9YK7,'0;
    12·1 answer
  • Write a loop statement to count and display the number of positive integers in the array. That is, your loop should display the
    14·1 answer
  • How to hard reset a iphone 7 without computer
    8·2 answers
  • 3. By default, Blender® remembers your last 32 actions and allows you to undo them one at a time by pressing CTRL+Z. (1 point)
    9·1 answer
  • How does AI use data
    7·1 answer
  • What techniques are required to accept
    12·1 answer
  • What is a web browser​
    9·1 answer
  • GIVING 50 POINTS!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!