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
Suppose that a machine with a 5-stage pipeline uses branch prediction. 15% of the instructions for a given test program are bran
zhenek [66]

Answer:

solution attached below

Explanation:

3 0
3 years ago
Intellectual property rights are exclusive rights that help protect both the created and the creation. IPR offers exclusively wh
dedylja [7]
IPR offers ownership of the intellectual property. The owner of the property has the right to a monetary gain from those who wish to use it.
8 0
3 years ago
Read 2 more answers
1.-  POR QUE LOS HUMANOS NOS INTERESAMOS EN ROBOTS CONASPECTO HUMANO?
oksian1 [2.3K]

Answer:

........

Explanation:

s

6 0
3 years ago
What is the main advantage of Ram<br><br>​
andre [41]

Answer:

to get milk

Explanation:

gjvuvuvjvvjvjvvjvjvhvjvub

7 0
4 years ago
1
g100num [7]
Have a look at the man page for printf:

man 3 printf
4 0
3 years ago
Read 2 more answers
Other questions:
  • What is the "host" in a typical email address?
    14·1 answer
  • What part of the communication feedback loop results in unclear communication?
    13·1 answer
  • You get a BRAINLIEST if you help me ASAP!
    11·2 answers
  • A recursive method may call other methods, including calling itself. A recursive method has:
    7·1 answer
  • Anyone know this awnser computer science
    14·2 answers
  • ____ returns the maximum number of elements that can be inserted into the vector container vecCont without reallocation.
    9·1 answer
  • Which one causes concerns for institutions or businesses when they are collected stores and they aren’t secured properly?
    5·1 answer
  • is the practice of using the internet to provide healthcare without going to a doctor’s office or hospital.
    15·1 answer
  • Molly needs to access a setting in microsoft windows group policy to change the type of a network to which a computer is attache
    15·1 answer
  • LCD, EL and gas-plasma are types of flat-panel screens.<br> True<br> False
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!