Respuesta :
Answer:
// program in Python
#variables
mx=-1000
mn=1000
#read 10 values from user
for i in range(1,11):
num=int(input("Enter the number {}:".format(i)))
#input validation
while num not in range(-100,100):
num=int(input("Wrong input!! Enter again:"))
#find maximum
if num<mn:
mn=num
#find minimum
if num>mx:
mx=num
#print maximum
print("largest value is:",mx)
#print minimum
print("smallest value is:",mn)
Explanation:
Create variables "mx" to store maximum and "mn" to store minimum.Read 10 numbers from user.If the input number if less than -100 or greater than 100 then ask again to enter a number between -100 to 100 only.Find the maximum and minimum from the all 10 numbers.Print maximum and minimum values.
Output:
Enter the number 1:23
Enter the number 2:-200
Wrong input!! Enter again:33
Enter the number 3:-2
Enter the number 4:45
Enter the number 5:105
Wrong input!! Enter again:45
Enter the number 6:-44
Enter the number 7:-56
Enter the number 8:79
Enter the number 9:98
Enter the number 10:4
largest value is: 98
smallest value is: -56
In this exercise we have to use the knowledge of computational language in python to describe the code, like this:
We can find the code in the attached image.
The code can be written more simply as:
mx=-1000
mn=1000
for i in range(1,11):
num=int(input("Enter the number {}:".format(i)))
while num not in range(-100,100):
num=int(input("Wrong input!! Enter again:"))
if num<mn:
mn=num
if num>mx:
mx=num
print("largest value is:",mx)
print("smallest value is:",mn)
See more about python at brainly.com/question/26104476
