Concept explainers
Three numbers
a. Write a
the same, “all different” if they are all different, and “neither” otherwise.
b. Write a program that reads three numbers and prints “increasing” if they are in
increasing order, “decreasing” if they are in decreasing order, and “neither”
otherwise. Here, “increasing” means “strictly increasing”, with each value larger
than its predecessor. The sequence 3 4 4 would not be considered increasing.
c. Repeat part b. but before reading the numbers, ask the user whether
increasing/decreasing should be “strict” or “lenient”. In lenient mode, the
sequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing and
decreasing
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 4 images
- The correct statements are: (ab)*a = a(ba)* (a U b)* b (a U b)* = a*b (a U b)* (a U b)* ba (a U b)* U a*b* = (a U b)* □ (a U b)* b (a U b)* U (a U b)* a (a U b)* = (a U b)*arrow_forwardFinish the function below that takes in the length of the two parallel sides of a trapezoid a and b, which are separated by a distance h, and returns its area. In [ ]: defarea_of_trapezoid(a,b,h):# YOUR CODE HEREraiseNotImplementedError() In [ ]: """Check that area_of_triangle returns the correct output for several inputs""" assert abs(area_of_trapezoid(3,3, 5) - 15) <=.1 assert abs(area_of_trapezoid(3,4, 5) - 17.5)arrow_forwardC - Right Facing Anglearrow_forward
- Using python, please explain 1: A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered The program should work as follows: Once the user has entered a number, the program should populate a list with all of the integers from 2 up through the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element whether it is a prime number.arrow_forward*Please help in javascript* Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 import java.util.Scanner; public class LabProgram {public static void main(String[] args) {/* Type your code here. */}}arrow_forwardComplete the following program that collects an input word from the keyboard and finds if the word is palindrome. A word is palindrome if the sequence of characters are the same from left-to-right and right-to-left, for example, "dad", "racecar" or "rotor" are all palindrome words because they can be read the same either forward or backward. word = input ("Entera word: ") 1s_palindrome = True i = -1 for if word[j] != word[1]: if not is palindrome: else: i-1 is palindrome = False print ("word is palindrome") jin range(len(word)) i+1 -1 print ("word is not palindrome") len(word) jin wordarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education