Question

Logic-2 close far prev I next chance Given three ints, a b c, return True if one of b or c is close (differing from a by at

Here's what I need you to do. Thank you to whoever is helping me in solving this problem. Please go on CodingBat.com and look for Logic-2, close_far. Once its found, type the code in their and click on "go" to compile the code. Once again, thank you. I'm going to comment down below to let you know if the code works or not.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def close_far(a, b, c):
    if (abs(a-b) <= 1 and abs(a-c) > 1 and abs(b-c) > 1) or (abs(a-b) > 1 and abs(b-c) > 1 and abs(a-c) <= 1):
        return True
    else:
        return False

Add a comment
Know the answer?
Add Answer to:
Here's what I need you to do. Thank you to whoever is helping me in solving...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • this is the function and here's what I did for this function but there is an...

    this is the function and here's what I did for this function but there is an error showing saying nonetype does not have type len() because math.ceil function (we cannot import any math..) for this function in python, if you could help me with this code. thanks gerer grodpugu def slice_list(1st: List(Any) ni int) -> List[List[Any]]: Return a list containing slices of <st> in order. Each slice is a List of size <n> containing the next <n> elements in <tst>....

  • need help on all parts please and thank you (e) What is the correct output of...

    need help on all parts please and thank you (e) What is the correct output of this code? (2 pts) >>> def func(x): >>> res = 0 >>> for i in range (len (x)): res i >>> return res >>> print (func(4)) ( 4 5 ) 6 ()7 ( What could be described as an immutable list? (2 pts) () a dimple ( ) a tuple ( ) a truffle () a dictionary (g) What is the result of the...

  • Please, I need help debuuging my code. Sample output is below MINN = 1 MAXX =...

    Please, I need help debuuging my code. Sample output is below MINN = 1 MAXX = 100 #gets an integer def getValidInt(MINN, MAXX):     message = "Enter an integer between" + str(MINN) + "and" + str(MAXX)+ "(inclusive): "#message to ask the user     num = int(input(message))     while num < MINN or num > MAXX:         print("Invalid choice!")         num = int(input(message))     #return result     return num #counts dupes def twoInARow(numbers):     ans = "No duplicates next to each...

  • I'm learning how to write loops in Python 3+ but need help in solving this function...

    I'm learning how to write loops in Python 3+ but need help in solving this function with another function: def babylonian_square_root(N, estimate, precision): new_estimate = (estimate + (N / estimate)) / 2 # I need to complete this using this function close_enough(). def close_enough(x, y, maximum_allowable_difference): ''' Returns True if x and y are within maximum_allowable_difference of each other. ''' # Note: "maximum" implies that we should use <= , but for this to work mathematically we need to use...

  • Thank You in advance for whoever is helping me!. All the blank/red spaces are wrong. I...

    Thank You in advance for whoever is helping me!. All the blank/red spaces are wrong. I just need help its so hard to figure out. Thank YOu Allen Products, Inc. Income Statement for the Year Ended December 31, 2019 Sales revenue $937,100 Less: cost of good sold Fixed 215,673 Variable 184,469 Gross profits $536,958 Less: operating expenses Fixed 132,722 Variable 56,572 Operating profits $347,664 Less: interest expense 32,799 Net profit before taxes $314,865 Less: taxes (rate 25%) 78,716 Net profits...

  • PROBLEM: Predict the molar absorptivity value of copper sulfate pentahydrate at 380 nm. Here's what I...

    PROBLEM: Predict the molar absorptivity value of copper sulfate pentahydrate at 380 nm. Here's what I think I have to do: I think I need to use beer's law. Abs=ebc; e=Abs/bc. b is 1.66 cm. I think c is .400 M NiSO4, but I'm not sure. I also think Abs is 0.758 given the graph. (If wavelength is 380 nm, then it should be between 0.598 and 0.798, right?) My answer is 1.14 L/mol*cm, but not sure if I am...

  • youre amazing!! thank you for helping me in advance, i needed this (1 point) Justin is...

    youre amazing!! thank you for helping me in advance, i needed this (1 point) Justin is interested in buying a digital phone. He visited 13 stores at random and recorded the price of the particular phone he wants. The sample of prices had a mean of $184.07 and a standard deviation of $30.98. (a) What critical value re should be used for a 95% confidence interval for the mean, M.of the distribution? (b) Calculate a 95% confidence interval for the...

  • I need help with the following and written in c++ thank you!: 1) replace the 2D...

    I need help with the following and written in c++ thank you!: 1) replace the 2D arrays with vectors 2) add a constructor to the Sudoku class that reads the initial configuration from a file 3) adds a function to the Sudoku class that writes the final Sudoku grid to a file or to the standard output device, cout. Sudoku.h #pragma once /* notes sudoku() default constructor precondition : none postcondition: grid is initialized to 0 sudoku(g[][9]) 1-parameter constructor precondition...

  • To whom it may concern, I would like to thank you in advance for helping me...

    To whom it may concern, I would like to thank you in advance for helping me with this question. Please follow this sample of the format that I provide below to answer the question. Here are the sample question and answer format. Question. On May 1, John Realty Company offered to sell a real estate parcel called Greenacre to Dallas, Inc, for $1,000,000. The offer was made by telegraph and stated that the offer would expire on May 15. Dallas...

  • thank you for helping me, i appreciate this so much, you are amazing !! Entered Answer...

    thank you for helping me, i appreciate this so much, you are amazing !! Entered Answer Preview Result 3.2498 3.2498 correct 3.94623 3.94623 incorrect At least one of the answers above is NOT correct. (1 point) A random sample of 10 size AA batteries for toys yield a mean of 3.84 hours with standard deviation, 1.2 hours. (a) Find the critical value, r*, for a 99% confidence interval.rº 3.2498 (b) Find the margin of error for a 99% confidence interval....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT