1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ronch [10]
3 years ago
10

Write a program that uses a loop to read 10 integers from the user. Each integer will be in the range from -100 to 100. After al

l 10 integers have been read, output the largest and smallest values that were entered, each on its own line in that order. If you want to best prepare yourself for the exam, avoid using the max or min functions from Python, and definitely use a loop to read the integers instead of 10 input statements. Zybooks won't stop you from doing these things, but you won't be studying the correct topics to prepare for the first exam.
Computers and Technology
1 answer:
LiRa [457]3 years ago
6 0

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  

You might be interested in
How has the dependence on technology made humanity less intelligent?​
shepuryov [24]

Answer:

People now rely on the internet for answers.

Nobody truly learns stuff and keeps it with them anymore. They know they can just search it again, and get the answer.

3 0
3 years ago
Suppose the work required to stretch a spring from 1.1m beyond its natural length to a meters beyond its natural length is 5 J,
Nadya [2.5K]

Answer:

Explanation:

The formula for the work done on a spring is:

W = \frac{1}{2}kx^{2}

where k is the spring constant and x is the change in length of the string

For the first statement,

x = (a-1.1), W = 5

=> 5 = \frac{1}{2}k(a-1.1)^{2}

Now making k the subject of formula, we have:

k = \frac{10}{(a-1.1)^2}  ---------------- (A)

For the second statement,

x = (a-4.8), W = 9

=> 9 = \frac{1}{2}k(a-4.8)^{2}

Now making k the subject of formula, we have:

k = \frac{18}{(a-4.8)^{2} } ------------------------- (B)

Equating A and B since k is constant, we have:

\frac{10}{(a-1.1)^{2} } = \frac{18}{(a-4.8)^{2} }

solving for the value of a

8a^{2} +56.4a-208.62=0

solving for a, we get:

a = 2.6801 or -9.7301

but since length cannot be negative, a = 2.68m

substituting the value of a in equation B, we have:

k=\frac{18}{(2.68-4.8)^{2} }

k = 4.005

6 0
4 years ago
To create an effective study schedule, a student must guess the amount of time needed for studying. write down all activities an
Inessa [10]

Answer:

B) write down all activities and commitments

Explanation:

It seems the most logical.

3 0
3 years ago
Read 2 more answers
Write a loop that prints each country's population in country_pop. Sample output with input:
Nostrana [21]

Answer:

  1. country_pop = {
  2.    'China': 1365830000,
  3.    'India': 1247220000,
  4.    'United States': 318463000,  
  5.    'Indonesia': 252164800
  6. }  
  7. for key in country_pop:
  8.    print(key + " has " + str(country_pop[key]) + " people")

Explanation:

The solution code is written in Python 3.

Given a dictionary, country_pop with data that includes four country along with their respective population (Line 1-6). We can use for in loop structure to traverse through each of the key (country) in the dictionary and print their respective population value (Line 7-8). The general loop structure through is as follow:

                    for key in dict:

                         do something

One key will be addressed for each round of loop and we can use that key to extract the corresponding value of the key (e.g. country_pop[key]) and print it out.

4 0
4 years ago
The proper hand position for keyboarding.
mr_godi [17]

Left fingers on ASDF whilst right hand is on jkl;

A= pinkie

S= ring finger

D=Middle

F=Index.

J=Index.

K=Middle

K=Ring finger

;= pinkie

Hope this helped

5 0
3 years ago
Other questions:
  • Match the web development languages to their type.
    13·1 answer
  • What should I do if I pluged in my computer charger and it starts making noise and sounds? Plz tell me. Will mark as brainliest
    6·1 answer
  • What is the most efficient way to prevent the spelling checker from repeatedly flagging a correctly spelled name in all of your
    5·1 answer
  • Write a method named countInRange that accepts three parameters: an ArrayList of integers, a minimum and maximum integer, and re
    6·1 answer
  • What would the math equation x = y create?
    9·1 answer
  • Quiz Time!
    14·1 answer
  • Free points <br><br><br><br><br> also if u wanna check out my spotlfy u can (xkuromist)
    6·2 answers
  • A search engine finds bugs and system failures in your computer.<br><br> True or False?
    7·2 answers
  • Write common ICT tools​
    5·1 answer
  • The specialized programs used by the operating systems to help ensure that memory is used properly and there are no memory confl
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!