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 would you have to know about the pivot columns in an augmented matrix in order to know that the linear system is consistent
Scrat [10]

Answer:

The Rouché-Capelli Theorem. This theorem establishes a connection between how a linear system behaves and the ranks of its coefficient matrix (A) and its counterpart the augmented matrix.

rank(A)=rank\left ( \left [ A|B \right ] \right )\:and\:n=rank(A)

Then satisfying this theorem the system is consistent and has one single solution.

Explanation:

1) To answer that, you should have to know The Rouché-Capelli Theorem. This theorem establishes a connection between how a linear system behaves and the ranks of its coefficient matrix (A) and its counterpart the augmented matrix.

rank(A)=rank\left ( \left [ A|B \right ] \right )\:and\:n=rank(A)

rank(A)

Then the system is consistent and has a unique solution.

<em>E.g.</em>

\left\{\begin{matrix}x-3y-2z=6 \\ 2x-4y-3z=8 \\ -3x+6y+8z=-5  \end{matrix}\right.

2) Writing it as Linear system

A=\begin{pmatrix}1 & -3 &-2 \\  2& -4 &-3 \\ -3 &6  &8 \end{pmatrix} B=\begin{pmatrix}6\\ 8\\ 5\end{pmatrix}

rank(A) =\left(\begin{matrix}7 & 0 & 0 \\0 & 7 & 0 \\0 & 0 & 7\end{matrix}\right)=3

3) The Rank (A) is 3 found through Gauss elimination

(A|B)=\begin{pmatrix}1 & -3 &-2  &6 \\  2& -4 &-3  &8 \\  -3&6  &8  &-5 \end{pmatrix}

rank(A|B)=\left(\begin{matrix}1 & -3 & -2 \\0 & 2 & 1 \\0 & 0 & \frac{7}{2}\end{matrix}\right)=3

4) The rank of (A|B) is also equal to 3, found through Gauss elimination:

So this linear system is consistent and has a unique solution.

8 0
3 years ago
Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date i
gizmo_the_mogwai [7]

Answer:

Following is given the code with all necessary description given as comments in it. I hope it will help you!

Explanation:

4 0
3 years ago
Company ABC has always used passwords to protect the highly confidential information in their company. Recently, someone who was
Leno4ka [110]
Company ABC should use passwords but also have them use a code so that not just anyone can get in. Kinda like facebook.
3 0
3 years ago
How to recover deleted photos after deleting from recently deleted
sweet-ann [11.9K]
You can’t sorry. Once they are deleted off there they are gone forever
6 0
2 years ago
Read 2 more answers
What entity created the open systems interconnection (osi) seven-layer model?
sweet [91]
The ISO developed the 7 layer OSI model.
8 0
3 years ago
Other questions:
  • Mobile devices typically come pre installed with standard apps like web browsers , media players, and mapping programs true or f
    9·1 answer
  • Which of the following is *not* true about logging user and program actions on a computer?
    10·1 answer
  • To defragment a disk means to ____. slow it down, diagnose problems with it, reorganize it, repair it
    8·1 answer
  • The variable planet_distances is associated with a dictionary that maps planet names to planetary distances from the sun. Write
    12·1 answer
  • The main path of the Internet along which data travels the fastest is known as the Internet ________. Group of answer choices
    11·1 answer
  • Which of the following is an online library?
    8·2 answers
  • Which of these is NOT a standard part of the outro of a podcast?
    15·1 answer
  • In what ways can you modify the location of the neutral point?
    11·1 answer
  • Which of the following database object hold data?
    13·2 answers
  • Create a class called StockTester that has the following fucntionality. a. Create a main method with an ArrayList named dataStoc
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!