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
The advantage of using a spreadsheet is:
Rama09 [41]

because it's a good thing

5 0
2 years ago
You use a cisco 2900 router in your network. you are considering purchasing and implementing the Unifield communications feature
Olenka [21]

Explanation:

License boot module c2900, technology-package uck9

7 0
3 years ago
You receive an email that appears to legitimately be from your Bank. The email indicates the need for verification of your infor
anzhelika [568]

Answer:

phishing

Explanation:

6 0
3 years ago
Read 2 more answers
Web designers use programming languages to write websites. A True <br> B False​
KonstantinChe [14]

Answer: False

Explanation:

Web designers are not using programming languages to write websites.

6 0
2 years ago
Read 2 more answers
When a computer is suffering from a virus, you can use a compiler to help remove the virus. True or false?
ipn [44]
True I think because it helps right?
8 0
3 years ago
Other questions:
  • Which of the following tends to be true of silent film acting as opposed to sound film acting?
    7·1 answer
  • "Because Standard Error and Standard Ouput represent the results of a command and Standard Input represents the input required f
    6·1 answer
  • An attacker compromises the Washington Post's web server and proceeds to modify the homepage slightly by inserting a 1x1 pixel i
    12·1 answer
  • Translate the following C program into an assembly program. The C program finds the minimal value of three signed integers. Assu
    13·1 answer
  • Can i edit my name on this app?
    7·1 answer
  • Apex
    5·2 answers
  • Which view in the View tab of the ribbon is the easiest place to add a header or a footer? Normal view Custom Views Page Layout
    5·2 answers
  • Need the answer ASAP!!!
    14·1 answer
  • A ……………………………is used to verify the identity of a website and is issued to the owner of the website by an independent and recogni
    7·2 answers
  • What type of malware is best known for carrying other malware as a payload?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!