5.15 Program: Strings and Comparisons
Write a program that reads three numbers and prints "all the same" if they are all the same, " all different" if they are all different, and "neither" otherwise.
For example,
Enter three numbers: 1 2 3 Your three numbers are all different.
print("Enter three numbers:")
n1 = int(input())
n2 = int(input())
n3 = int(input())
print()
if(n1==n2 and n2==n3):
print("Your three numbers are all the same.")
elif(n1!=n2 and n2!=n3 and n3!=n1):
print("Your three numbers are all different.")
else:
print("Your three numbers neither same nor different")


5.15 Program: Strings and Comparisons Write a program that reads three numbers and prints "all the...
•• E3.5Write 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. •• E3.6Repeat Exercise •• E3.5, 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...
Write a function in PYTHON that reads a sequence of numbers ended by 0 and prints “Sorted” if the numbers were input in increasing or decreasing order, otherwise the program must print “Not sorted” (Do not calculate 0) Sample Input 4 3 -1 -5 0 Sample Output Sorted
Write a program that reads an integer greater or equal to 2, n, and prints a shape of a nline hollow inverted pyramid of stars. Your program should interact with the user exactly as it shows in the following two executions: Execution example 1: Please enter an integer, greater or equal to 2: 5 ********* -*----- * --*--- * ---*--* ----* Execution example 2: Please enter an integer, greater or equal to 2: 3 ***** -* * --*
Write a program that reads in two hexadecimal numbers from a file, hex.dat, and prints out the sum of the two numbers in hexadecimal. (As noted in class, first do this without using a file and by reading using the cin > > command) From Wikipedia: "In mathematics and computer science, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0-9 to...
Write a Java program that reads four integers and prints "two pairs" if the input consists of two matching pairs (in some order) and "not two pairs" otherwise. For example, 1 2 2 1 two pairs 1 2 2 3 not two pairs 2 2 2 2 two pairs
Write a PYTHON program that reads in three strings and sorts them lexicographically. Do NOT user the sort function. Enter string 1: Charlie Enter string 2: Able Enter string 3: Baker Able Baker Charlie Your code with comments A screenshot of the execution Test Cases: Able, Baker, Charlie Baker, Charlie, Able Charlie, Able, Baker Able, Charlie, Baker Baker, Able, Charlie Charlie, Baker, Able
8.(a) Write a program that prints all of the numbers from 0 to 102 divisible by either 3 or 7. (b) Write a program that prints all of the numbers from 0 to 102 divisible by both 3 and 7 (c) Write a program that prints all of the even numbers from 0 to 102 divisible by both 3 and 7 (d) Write a program that prints all of the odd numbers from 0 to 102 divisible by both...
Write a program file_max.c that reads a set of integer numbers from a file and prints out the maximum number to standard output. The name of the input file should be specified as a command line argument.
Write a Java program Two.java that satisfies the following requirements. 1. The program reads AT LEAST TWO Strings as command line arguments. 2. The program compares all Strings lexicographically and outputs the greatest. For example, running the following command after Two.java compiles >> java Two Ant Bat Dig Dog Cat prints Dog
In python please. Write a program that reads whitespace delimited strings (words) and an integer (freq). Then, the program outputs the strings from words that have a frequency equal to freq in a case insensitive manner. Your specific task is to write a function wordsOfFreqency(words, freq), which will return a list of strings (in the order in which they appear in the original list) that have a frequency same as the function parameter freq. The parameter words to the function...