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
Elodia [21]
3 years ago
14

Create a function called notBad that takes a single argument, a string.

Computers and Technology
1 answer:
igomit [66]3 years ago
3 0

Answer:

The Following are the method definition to this question:

def notBad(s):#defining a method notBad that take s variable as parameter

   if 'not' not in s or 'bad' not in s: # defining If block that checks "not or bad" is not in the string

       return s#return string value

   n= s.index('not')#defining n variable that store index value of not

   b= s.index('bad')#defining b variable that store index value of bad

   if n<b:#defining if block that compare n and b value  

       return s[:n]+'good'+s[b+3:]#use slicling for remove value and add another value

print(notBad('This dinner is not that bad!'))#call method and print value

print(notBad('This movie is not that bad!'))#call method and print value

print(notBad('This dinner bad!'))#call method and print value

Output:

This dinner is good!

This movie is good!

This dinner bad!

Explanation:

In the above given, method definition a method "notBad" is defined that takes variable "s" as a parameter, which is used for input the string value.

In the next step, an if block, is defined, that checks in string value "not or bad" are not available in the input string. if the condition is true, it will return, that string value.

In the next line "n and b" variable has defined, that store "not and bad" index value, and use if block that the come to its value and use slicing to re remove its value.

You might be interested in
What are the design concepts and assumptions behind a class, an object and the relationship between them? What are the roles met
Triss [41]

Answer:

Object-oriented programming (OOP) is a procedural language and based on classes associated with an object. Without classes and object relationship OOP is not possible. According to program's design concept classes provide abstraction and encapsulation with the help of object. Object have states and behaviors like cat has states like name, color and  cat has also behaviors like  wagging the tail, eating, jumping etc. A class forms template or blueprints for these states and behaviors because different cats have different behaviors and states.

Methods provide a way for encapsulation and accessing private class members with public methods and static fields are sometimes best alternative for global variable. We can use static field when it same for all and shared by all objects of that class and it can save memory because we do not have to initialize it for each object

8 0
3 years ago
You are trying to connect a new USB device to your computer. You install the driver and then connect the device to an open USB
nadezda [96]

Answer:

By order of increasing magnitude:

D. Make sure the USB device is plugged in properly.

A. Try a different USB cable.

B. Replace the USB device.

C. Install a new USB controller card.

Explanation:

Start with whatever is simplest first. Most errors are simply ID-10-T mistakes.

3 0
2 years ago
1. Name the first PC virus.<br> 2. In which language are viruses written for Microsoft programs?
Tju [1.3M]

Answer:

The first IBM PC virus in the "wild" was a boot sector virus dubbed (c)Brain, created in 1986 by Amjad Farooq Alvi and Basit Farooq Alvi in Lahore, Pakistan, reportedly to deter unauthorized copying of the software they had written. The first virus to specifically target Microsoft Windows, WinVir was discovered in April 1992, two years after the release of Windows 3.0.

Explanation:

HOPE THIS HELPS

6 0
3 years ago
Read 2 more answers
B =(-21) (0) + (-50) ÷ (-5)​
Irina-Kira [14]

Answer:

B=10

Explanation:

(-21) x 0=0 and (-50)÷(-5)=10

0+10=10

8 0
2 years ago
Photo editing software, desktop publishing, email and word processing software is most likely to be used by:
FrozenT [24]

Answer:

c) mass media personnel

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer how to perform a specific task and to solve a particular problem.

Basically, softwares are categorized into two (2) main categories and these are;

I. System softwares.

II. Utility softwares.

Photo editing software, desktop publishing, email and word processing software is most likely to be used by a mass media personnel because he or she deals with the creation of various documents such as images, texts, multimedia files etc.

4 0
2 years ago
Other questions:
  • What are some characteristics of filtering junk email in Outlook 2016? Check all that apply.
    9·2 answers
  • Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p
    14·1 answer
  • How is a technical certificate like a computer-related associate degree?
    12·2 answers
  • Can anyone fill in the space please
    6·1 answer
  • If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
    11·2 answers
  • What is the purpose of this parallelogram shape in a flowchart? O decision process o input or output start or end​
    13·1 answer
  • Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter.
    6·1 answer
  • In a swap you need a variable so that one of the values is not lost ? Need help
    7·2 answers
  • What is one of the advantages of using an algorithm to solve a puzzle like Kriss-Kross or Sudoku?
    13·1 answer
  • Say true or false
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!