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
aleksandr82 [10.1K]
2 years ago
8

8.13 LAB: Elements in a range Write a program that first gets a list of integers from input. That list is followed by two more i

ntegers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). Ex: If the input is: 25 51 0 200 33 0 50 the output is: 25 0 33 The bounds are 0-50, so 51 and 200 are out of range and thus not output. For coding simplicity, follow each output integer by a space, even the last one. Do not end with newline
Computers and Technology
1 answer:
MArishka [77]2 years ago
5 0

Answer:

  1. myList = []
  2. num = int(input("Enter a number: "))
  3. while(num != -1):
  4.    myList.append(num)
  5.    num = int(input("Enter a number: "))
  6. output = ""
  7. for i in range(0, len(myList) - 2):
  8.    lastIndex = len(myList) - 1
  9.    secondLastIndex = len(myList) - 2
  10.    if(myList[i] >= myList[secondLastIndex] and myList[i] <= myList[lastIndex]):
  11.        output += str(myList[i]) + " "
  12. print(output)  

Explanation:

The solution is written in Python 3.

Firstly, create a list to hold the user input of integers.

Next,  use input function to prompt user to enter integer and assign it to num

While the input num is not -1, keep prompting the user to input number and add it to myList (Line 4 - 6)

Create a output string variable (Line 8)

Create a for loop to traverse through the first element to third last of the element because the last two elements are bounds (Line 9).

Get the last and second last index (Line 10 -11)

Create an if statement to check the current element is within the lower bound and upper bound. If so, join the element to output string (Line 12 - 13).

After the loop, print the output string (Line 15).

You might be interested in
Why would it be unusual to find a fossil of an organism’s eye?
Slav-nsk [51]
<span>The preservation of anything other than mineral skeletons is (with a few exceptions described below) an extremely rare event. Anything that can decay is likely to be lost. Fur, skin, internal organs – all are immensely vulnerable to the destruction by bacteria, fungi and scavengers that assure their recycling back into the ecosystem. </span>
8 0
2 years ago
You are working on a graphical app, which includes multiple different shapes. The given code declares a base Shape class with an
ycow [4]

Answer:

maybe

Explanation:

5 0
2 years ago
A digital certificate system: Group of answer choices uses digital signatures to validate a user's identity. is used primarily b
kompoz [17]

Answer:

uses third party CAs to validate a user's identity

Explanation:

The Digital Certificate is the only means that technically and legally guarantees the identity of a person on the Internet. This is an essential requirement for institutions to offer secure services over the Internet. Further:

The digital certificate allows the electronic signature of documents The recipient of a signed document can be sure that it is the original and has not been tampered with and the author of the electronic signature cannot deny the authorship of this signature.

The digital certificate allows encryption of communications. Only the recipient of the information will be able to access its content.

4 0
3 years ago
Select the correct answer.
Mekhanik [1.2K]
The best answer is A
5 0
2 years ago
Read 2 more answers
The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
Scrat [10]

Answer:

operating system

Explanation:

System software are those programs that many refer to as computer programs. The most basic function of system software is to manage the computer systems. It acts as an interface between the computer’s hardware and the end user. System software converts instructions that end users give to the computer into a machine understandable language. Examples of system software include operating systems, utility programs, device drivers, and windows systems. The operating system is responsible for the functioning of all the computer’s hardware parts. It is the software loaded into the system when the computer boots up. It manages everything, from the memory, to the CPU, and many other different tasks.

8 0
3 years ago
Other questions:
  • You bought a monochrome laser printer two years ago. The printer has gradually stopped feeding paper. Which printer component sh
    14·1 answer
  • While visiting a web site during your lunch break, you see a window that states the web site will not operate properly without f
    13·1 answer
  • Describe any four rights of users of information systems.
    8·1 answer
  • Which piece of computer hardware was revised to run hypervisors natively?
    12·2 answers
  • How to wire two separate switches &amp; lights using the same power source?
    14·1 answer
  • The objects that you place on master pages are called _____.
    6·1 answer
  • To move an object to the bottom of the stack, click the Send Backwards arrow and then click Send to Back in the Arrange group on
    7·1 answer
  • Please help!!! I am very confused about this question!
    10·1 answer
  • I need some help-
    15·1 answer
  • How does the use of blocking affect the external sorting algorithm, and how does it change the cost formula
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!