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
zmey [24]
3 years ago
4

Question 2. Complete the following conditional statement so that the string 'More please' is assigned to the variable say_please

if the number of nachos with cheese in ten_nachos is less than 5. Hint: You should not have to directly reference the variable ten_nachos.
Computers and Technology
1 answer:
sattari [20]3 years ago
3 0

Answer:

The solution code is written in Python 3:

  1. ten_nachos = [True, True, False, False, False, True, False, True, False, False]
  2. count = 0
  3. for x in ten_nachos:
  4.    if (x == True):
  5.        count += 1
  6. if count < 5:
  7.    say_please = "More please"

Explanation:

By presuming the ten_nachos hold an array of True and False values with True referring to nachos with cheese and False referring to without cheese (Line 1).

We create a counter variable, count to track the occurrence of True value in the ten_nachos (Line 3).

Create a for-loop and traverse through the True and False value in the ten_nachos and then check if the current value is True, increment count by 1 (Line 5 - 7).

If the count is less than 5, assign string "More please" to variable say_please (Line 9 -10).

You might be interested in
8.4 Lesson Practice <br> edhesive quiz
kow [346]

Answer:

1. 5

2. Because they let us quickly process the contents of an array, which have many values.

Explanation:

8 0
3 years ago
____ are likely in the event of a hacker attack, when the attacker retreats to a chat room and describes in specific detail to h
Masja [62]

Answer:

Follow-on incidents.

Explanation:

When the hacker hacks something successfully and after that when he or she  discusses or describes the details to his or her associates and the method which he or she used to do the hacking is called Follow-on incidents because the hacker has successfully completed his or her conquest the event is happening after that.

4 0
4 years ago
Index addressing is for traversing arrays.<br><br> True<br><br> False
valina [46]

Answer:

False.

Explanation:

Index addressing is not for only traversing the arrays but to also access the element,manipulate them.Though indexing is also used in traversing but it is not solely for that.Indexing in an array starts from 0 to size-1.

for example:-

We have an array a of size 10.So to access the element at position 6.We have to write.

a[5];

Manipulating it

a[5]=6;

8 0
4 years ago
Julie I'm here so help me I'm red
aniked [119]

Answer:

hey hey hey hey hey hey hey hey

Explanation:

hey hey hey hey hey hey hey hey

7 0
4 years ago
A friend a just opened his own barber shop and has asked you to develop a program to track the type of service the customer is r
True [87]

Answer:

class Barber(object):

   barber_shop = "Big AI's barber shop"

   def __init__(self, customer_name, type_of_service=[], tip=0):

       self.cust_name = customer_name

       self.tos = type_of_service

       self.tip = tip

   def service_type(self, *args):

       for i in args:

           self.tos.append(i)

   def total(self):

       

       services = {'trimming':10, 'hair_cut':20, 'shaving':15, 'washing':5, 'dyeing':5}

       contain = ''

       total = 0

       for service in self.tos:

           if service in services.keys():

               total += services[service]

               contain += f'{service}: {services[service]}\n'

       

       print(self.barber_shop,'\n', self.cust_name,'\n', 'Services:',contain.splitlines(),'\n', \

           f'total: ${total}', '\n',f'Tip: ${self.tip}')

mycust = Barber('John',['washing'],6 )

mycust.service_type('shaving', 'dyeing')

mycust.total()

Explanation:

The Barber class is a blueprint used to create an object instance of customers that visits the barber-shop. It has two methods 'service_type' and 'total' which are just defined functions of the class that appends services to the type of service variable and total that prints the total cost of services on the screen.

4 0
3 years ago
Other questions:
  • Elvis has asked Bonnie out on a date to a baseball game. Elvis is a friend of Bonnie's classmate Ginger and she has met him a fe
    5·2 answers
  • What 2 major agricultural inventions did jethro tull create?
    10·2 answers
  • when you assign a(n) ___ to a field, Access will display the value you assign, rather than the field name, in datasheets and in
    15·1 answer
  • Why was unicode invented?
    10·1 answer
  • During his last performance review, Franco's boss urged him to set some short-term and long-term sales goals to help him perform
    6·2 answers
  • Is the address 7b invalid regarding cell references?
    8·1 answer
  • How do we add questions on sam Blockly?​
    6·1 answer
  • Write a program to find a perimeter of rectangle using SUB.. ..End SUB​
    14·2 answers
  • Which things computer case contains
    10·1 answer
  • How do I find unwanted programs on my computer?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!