Write a program in file MinMax.py that accepts an arbitrary number of integer inputs from the user and prints out the minimum and maximum of the numbers entered. The user will end the input loop by typing in the string 'stop'. When the user enters 'stop' your program should print out the minimum integer entered and the maximum integer entered. If the user enters 'stop' immediately (i.e., before any numbers are entered), you'll print a slightly different message. See the examples below: You can assume that the values entered are integers (positive, negative or zero) or the string 'stop' (lowercase). You don't have to validate the inputs. > python Min Max. py
Enter an integer or 'stop' to end: stop You didn't enter any numbers > python Min Max. py
Enter an integer or 'stop' to end: -10
Enter an integer or 'stop' to end: 0 Enter an integer or 'stop' to end: +42
Enter an integer or 'stop' to end: 87 Enter an integer or 'stop' to end: -100
Enter an integer or 'stop' to end: stop The maximum is 87 The minimum is -100

Answers

Answer 1

Answer:

The program is as follows:

numlist = []

num = input("'stop' to end: ")

while not (num == "stop"):

   numlist.append(int(num))

   num = input("'stop' to end: ")

   

if len(numlist) == 0:

   print("You didn't enter any numbers")

else:

   print("The maximum is "+str(max(numlist))+" and The minimum is "+str(min(numlist)))

Explanation:

This declares an empty list

numlist = []

This prompts the user for input

num = input("'stop' to end: ")

This loop is repeated until the user enters 'stop'

while not (num == "stop"):

This appends the input to the list

   numlist .append(int(num))

This prompts the user for input

   num = input("'stop' to end: ")

   

If the length of the list is 0, then the user entered no input

if len(numlist) == 0:

   print("You didn't enter any numbers")

If otherwise, this prints the min and the max

else:

   print("The maximum is "+str(max(numlist))+" and The minimum is "+str(min(numlist)))

Answer 2

The program that accepts an arbitrary number of integer inputs from the user and prints out the minimum and maximum of the numbers entered is as follows:

numbers = []

x = input("Enter an integer and stop to end: ")

while not(x == "stop"):

    numbers.append(int(x))

    x = input("Enter an integer and stop to end: ")

if len(numbers) == 0:

    print("You didn't enter any numbers ")

else:

    print(f"The maximum number is {max(numbers)} and the minimum number is {min(numbers)}")

Code explanation:

The code is written in python

The first line of code, we declared a variable named numbers and it is an empty list for storing our integers.The variable x is stores the user inputwhile the user's input is not lowercase "stop", the user's input is appended to numbers. Then the program ask for the users input as long as it is an integers inputif the length of the list is 0, then we print a statement to ask the user to enter a number.Else we print the maximum and minimum number of the user's input.

learn more on python code here: https://brainly.com/question/19175881

Write A Program In File MinMax.py That Accepts An Arbitrary Number Of Integer Inputs From The User And
Write A Program In File MinMax.py That Accepts An Arbitrary Number Of Integer Inputs From The User And

Related Questions

Rupesh wants to try programming with Eclipse. What is the first step he should take to make that happen?


download the Eclipse IDE

download the current Java Development Kit

create a restore point

disable his security program

Answers

Answer:

create a restore point

Explanation:

A gui allows you to interact with objects on the screen such as icons and buttons true or false

Answers

Answer:

True

Explanation:

Which is a potential disadvantage of emerging technologies? A. increased spread of misinformation due to advanced communication technologies B. inefficient usage of energy due to advanced manufacturing technologies C. only benefiting developed countries rather than developing ones D. slowing down global economic growth

Answers

Answer: I believe it’s D.

Explanation: Less developed countries may not be able to afford the new technology, while more developed ones will be able to do so. Meaning the less developed countries will most likely not change.

Write a function charInWord that takes in two parameters, a char (character) and a word (string). The program will return true if the character is in the word and false if it is not. If word is not a string type, or if char is not a string type, or if the length of char is greater than 1, the function should return None. Your main program should call the function and print char is in word if the function returns true, or char is not in word if the function returns false, using the user-supplied values instead of char and word. The program should print incorrect input provided if the function returns None. Ex: If the input is: a cat the output is: a is in cat Ex: If the input is: a club the output is: a is not in club Ex: If the input is: ab horse the output is:

Answers

Answer:

The program in Python, is as follows:

def charInWord(chr,word):

   if len(chr)>1:

       print("None")

   elif not(chr.isalpha() and word.isalpha()):

       print("None")

   else:

       if word.find(chr) == -1:

           print(chr+" is not in "+word)

       else:

           print(chr+" is in "+word)

chr = input("Character: ")

word = input("Word: ")

print(charInWord(chr,word))

Explanation:

This defines the function

def charInWord(chr,word):

This checks if the length of character is greater than 1

   if len(chr)>1:

If yes, it prints None

       print("None")

This checks if the character or the word contains invalid character

   elif not(chr.isalpha() and word.isalpha()):

If yes, it prints None

       print("None")

This is executed for valid parameters

   else:

If the character is not present, this is executed

       if word.find(chr) == -1:

           print(chr+" is not in "+word)

If the character is present, this is executed

       else:

           print(chr+" is in "+word)

The main begins here

This gets the character

chr = input("Character: ")

This gets the word

word = input("Word: ")

This calls the method and prints the required output

print(charInWord(chr,word))

Junie is researching Ancient Egypt. She found a website that is full of information and great
images. As she is reading the text, she notices that there are little bits of information that don't
really agree with any of the other research she has done. What should she do?
O Use the website. Most of the information seems correct.
OUse only the information that she needs and ignore the information that doesn't seem right.
O Ask her friend what he thinks about the website.
O Evaluate the site using the CARS checklist to see if the site is valid and reliable.

Answers

Answer: Evaluate the site using the CARS checklist to see if the site is valid and reliable.

Explanation:

Other Questions
How can the healthy coping skill be helpful if you are grieving loss of a loved one, also give an example of your explanation please help me with this question! I dont understand this A gym has 11 rows of elliptical machines with 13 machines in each row. The gym also has 14 rows of treadmills with 12 treadmills in each row. What is the maximum number of people that can use the elliptical machines and the treadmills at the same time? Which ailment does the girl in the picture most likely have?.picazn .hinchaznOC. diarreaODfiebre which of the following is a gas at room temperature A. jelloB. milkC. heliumD. popcorn Describe the transformation and identify the domain and range.f (x) = -(x - 2)^2f (x) = x + 1 - 3 18. Which tool of the biologist is more suitable for culturing bacteria in thelaboratory?A. Test tubesC. Perti dishesB. MicroscopesD. Beakers An isosceles triangle has an angle that measures 102. Which other angles could be in that isosceles triangle? Ernests words reminded people of the wise old sayings.____True or false Mikhail gorbachevs reforms of perestroika and glasnost resulted in? Define discrimination and write a sentence using the word.Define discrimination and write a sentence using the word. Please help me with this answer Pldsssssss help???? Please help!! The subject is on Logical Fallacies - Methods of motivation 2. Analyzing the effect of the author's use of the logical fallacy in this paragraph allows the reader to-A. correct the author's errors.B. research evidence about the topic.C. evaluate the effectiveness of the author's argument.D. become an expert on the issue being discussed. in isosceles trapezoid EFGH, FG parallel EH, FG=10, GH=12, and E=60. Find the area of EFGH. Why did it take so long for Mexico to recognize Texas as independent? In an argumentative essay, where does the claim statement go? a at the end of the last paragraph b in the beginning of the second paragraph c in the beginning of the third paragraph d at the end of the first paragraph Every five years in August, the population of a certain city is recorded. In 2010, the city had a populationof 7500 people. From 2010 to 2015, the population decreased by 20%. From 2015 to 2020, thepopulation increased by 55%. What was the city's population in 2020? (3 points) Calculate the formula weight or molecular for the following: a. LiCI b. SO2 (The 2 is in subscript) On this map, how is the international border between Northern Ireland and the Republic of Ireland represented?