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]
3 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]3 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 does the phrase "compatibility mode” appear when opening a workbook?
nlexa [21]

Answer: 2. A version older than Excel 2016 was used to create the workbook .

Explanation: The compatibility mode appears whenever a workbook initially prepared using an excel software version which is older than the excel software which is used in opening the file or workbook. The compatibility mode is displayed due to the difference in software version where the original version used in preparing the workbook is older than the version used in opening the workbook. With compatibility mode displayed, new features won't be applied on the document.

7 0
3 years ago
Read 2 more answers
What is the code range for the integumentary system subsection in the cpt coding manual?
boyakko [2]
The code range is <span>10021-19499
</span>

Procedures on the integumentary system have their codes that range within 10021 – 19499 of the CPT manual. This is the 1st subsection of surgery. You will find codes for skin tag removal, incisions, and wound debridement at the front of the integumentary system.



6 0
4 years ago
Match each role to the corresponding web development task.
trapecia [35]

Answer:

1. Art director: selecting color palettes.

2. Web project manager: creating budget spreadsheets.

3. Usability lead: researching target audiences.

4. Developer: coding.

Explanation:

HTML is an acronym for hypertext markup language and it is a standard programming language which is used for designing, developing and creating web pages.

Generally, all HTML documents are divided into two (2) main parts; body and head. The head contains information such as version of HTML, title of a page, metadata, link to custom favicons and CSS etc. The body of the HTML document contains the contents or informations of a web page to be displayed.

The various role performed during the web development process (task) includes;

1. Art director: selecting color palettes. This individual is saddled with the responsibility of choosing the color that best fits a website.

2. Web project manager: creating budget spreadsheets. He or she is responsible for performing tasks such as creating a financial (budget) plan, start and finish date (timing), procurement, etc.

3. Usability lead: researching target audiences. This individual is saddled with the responsibility of surveying and collecting data from the demography for which the website is designed.

4. Developer: coding. This is the technical expert referred to as a web developer and is responsible for writing the set of instructions (codes) that enables the website to work properly and serve a purpose.

5 0
3 years ago
What vowel(s)!are Missing in the Word= "a b t" ???
grigory [225]
O AND U which spells ABOUT
5 0
3 years ago
Where in PowerPoint should a user navigate to complete the tasks listed below?
lana [24]

Answer:

Quick Access toolbar

Ribbon

Quick Access toolbar

Ribbon

Explanation:

edge2021

7 0
3 years ago
Other questions:
  • What is the purpose of using modulo 2 arithmetic rather than binary arithmetic in computing an fcs?
    7·1 answer
  • Tricia needs to tell her browser how to display a web page. What will she need to use? Compiler
    8·1 answer
  • What effect does screen resolution have on how graphics are displayed?
    7·1 answer
  • which internet technology allows businesses to make presentation and share visual aids such as charts and graphs
    14·2 answers
  • What are three attributes of the input tag
    5·1 answer
  • You wrote a program to allow the user to guess a number. Complete the code to generate a random integer from one to 10.
    8·2 answers
  • True or False. A geosynchronous satellite changes its area in the sky each day.
    5·2 answers
  • Tascake Gets Free Brainliest Because he didnt get it<br><br> Tascake Heres Brainliest
    6·2 answers
  • What maintains data about various types of objects, events, people, and places?
    10·1 answer
  • What does the x mean in .docx
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!