Program:
# set repeat to true, variable used for looping
repeat = True
count = 0
lowest = -1
highest = -1
# run a loop as long as repeat is true
while repeat:
# read a number from the user
n = int(input("Enter a number (negative number
to quit):"))
# set repeat to false to terminate the loop if a
negative number is entered
if(n < 0):
repeat = False
# proceed if positive number is entered
else:
# if the number entered
is first number, assume it be highest and lowest
if (count == 0):
lowest = n
highest = n
# if not the first
number, then find the highest and lowest numbers
else:
# if the number is less than lowest store n in lowest
if(n < lowest):
lowest = n
# if the number is greater than highest store n in highest
if(n > highest):
highest = n
# increment the count of
numbers read
count = count + 1
# if no numbers are entered display appropriate message
if(count == 0):
print("No numbers entered.")
# else display the highest and lowest number
else:
print("\nThe highest number entered is: " +
str(highest))
print("The lowest number entered is: " +
str(lowest))
Output:
Program Screenshot:
Let me know if you have any concerns with the above solution.
must be in python p p+ 1 endwhile 2. Design a program that allows a user...
In C++ 2. Write a program that allows the user to enter a series of positive numbers between 1 and 100 and displays the smallest and largest of the numbers entered. The program should not store the numbers that were entered, only keep track of the smallest and largest ones. The program should continue accepting numbers until the value 0 is entered and then display the results. If a number out of range is entered, tell the user it is...
a. Design the logic for a program that allows a user to enter 12 numbers, then displays them in the reverse order of entry. b. Modify the reverse-display program so that the user can enter any amount of numbers up to 12 until a sentinel value is entered. ( I really could use more of a pseudocode rather than actual code. also an explanation of each step. The answer I got last time was just c++ code that including a...
Design the logic for a program that allows the user to enter a maximum of 10 numbers. If the use enters a -1 the input loop stops early. The value -1 is not data but a quit flag value that is not entered into the array. Then the program displays the count of the numbers entered and numeric average of the numbers (not including the -1 of course). After display the average of all the entered numbers, the program will...
Design the logic for a program that allows a user to enter 10 numbers, then displays the element number, value in the element, and its squared. The language is Python
Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING
in Python: Write a program that allows the user to enter a number between 1-5 and returns an animal fact based on what the user entered. The program should 1. Continue to run until the user enters “quit” to terminate the program, and 2. Validate the user’s input (the only acceptable input is 1, 2, 3, 4, 5 or “quit”). You can use the following animal facts: An octopus is a highly intelligent invertebrate and a master of disguise. Elephants...
2) Largest and Smallest Design a program with a loop that lets the user enter a series of numbers. The user should enter-99-99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered. a) Use a Do-Until Loop
Design the logic for a program that allows a user to enter 10 numbers, then displays all of the numbers, the sum and average of the numbers. (Use array and loop.) the pseudocode in python please
Write a Python program that allows the user to enter the total rainfall for each of 12 months into a list. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest rainfall amounts. Data: January: 8.9 inches February: 11.1 inches March: 13.4 inches April: 6.9 inches May: 8.7 inches June: 9.1 inches July: 15.9 inches August: 4.4 inches September: 3.1 inches October: 5.6 inches November: 7.8...