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
What is the HIPAA Privacy rule, and why does it affect IT professionals?
CaHeK987 [17]

Solution:

The HIPAA Privacy Rule establishes national standards to protect individuals' medical records and other personal health information and applies to health plans, health care clearinghouses, and those health care providers that conduct certain health care transactions electronically.

IT affects it by these ways:

The HIPAA Privacy Rule for the first time creates national standards to protect individuals’ medical records and other personal health information.

• It gives patients more control over their health information.

• It sets boundaries on the use and release of health records.

• It establishes appropriate safeguards that health care providers and others must achieve to protect the privacy of health information.

• It holds violators accountable, with civil and criminal penalties that can be imposed if they violate patients’ privacy rights.

• And it strikes a balance when public responsibility supports disclosure of some forms of data – for example, to protect public health.

This takes for patient.

• It enables patients to find out how their information may be used, and about certain disclosures of their information that have been made.

• It generally limits release of information to the minimum reasonably needed for the purpose of the disclosure.

• It generally gives patients the right to examine and obtain a copy of their own health records and request corrections.

6 0
3 years ago
Which term means a cryptography mechanism that hides secret communications within various forms of data?.
andrezito [222]

Answer:

anything u have daling

Explanation:

6 0
2 years ago
Most users find settings between ____ to be the most convenient option for how long the computer sits idle before the screen sav
Sphinxa [80]
I would say about 5 to 10 minutes
3 0
3 years ago
Since all Java data types (numbers, strings, etc) can be represented as strings, the _______ format specifier can receive any ty
astra-53 [7]

In Java programming, the <u>%s</u> format specifier can receive any type of Java data.

<h3>The kinds of data type.</h3>

In Computer programming, there are five recognized data types and these include:

  • Integer type (int).
  • Character type (char).
  • Floating point type (float).
  • Boolean (bool)
  • String (str)

<h3>What is a string?</h3>

A string is a data type which is typically used for data values that comprises ordered sequences of characters.

In Java programming, strings can be used to represent all Java data types such as numbers, Boolean, strings, etc. Also, the <u>%s</u> format specifier can be used by a programmer or software developer to receive any type of Java data.

Read more on a string here: brainly.com/question/25619349

5 0
2 years ago
Look at the slide.
svetlana [45]

Answer:

c

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • What is faster a hi-speed usb port or superspeed usb port?
    13·1 answer
  • In a @return tag statement the description:
    13·2 answers
  • How to change screen brightness windows 10?
    7·1 answer
  • Why is it a good idea to leave an interview being courteous and polite?
    10·1 answer
  • Referential integrity states that:______.
    15·1 answer
  • Vpn stands for _____. very precise settings virtual private network virtual public network vice prestigious setup
    5·1 answer
  • Give one example of where augmented reality is used​
    11·2 answers
  • What does IDLE stand for
    11·2 answers
  • which of the following is the most appropriate way to write css style for the font family property in html
    8·1 answer
  • to provide for ecmascript compatibility in older browsers, you can use group of answer choices javascript shivs javascript shims
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!