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
Isabel and Jared work for the same company but in different departments. Their workstations are both part of the company's compu
Nina [5.8K]

Network access limitations implemented from their local IT Department

3 0
3 years ago
Read 2 more answers
3. Write a program that prompts the user to input an integer that represents cents. The program will then calculate the smallest
miss Akunina [59]

Answer:

The program in Python is as follows:

cents = int(input("Cents: "))

qtr = int(cents/25)

cents = cents -qtr * 25

nkl = int(cents/5)

pny = cents -nkl * 5

print(qtr,"quarters,",nkl,"nickels,",pny,"pennies")

Explanation:

This gets input for cents

cents = int(input("Cents: "))

This calculates the quarters in cents

qtr = int(cents/25)

This gets the remaining cents

cents = cents -qtr * 25

This calculates the nickel in remaining cents

nkl = int(cents/5)

This calculates the pennies in remaining cents

pny = cents -nkl * 5

This prints the required output

print(qtr,"quarters,",nkl,"nickels,",pny,"pennies")

6 0
3 years ago
Which example can be considered master data in an organization?
Svetradugi [14.3K]
Employee information can be considered master data in an organization
3 0
3 years ago
List at least six things you would check for if you were asked to evaluate the workspace of an employee for ergonomics
Evgen [1.6K]

Assessing the risk that surrounds stationary work of employees spending hours at their stations is essential. Below is a list of fundamental ergonomic principles that help identify ergonomic risk factors.


<span>1.       </span>Are the employees maintained in a neutral posture?

<span>2.       </span>Does the stationery allow for movement and stretching?

<span>3.       </span>Is there adequate lighting?

<span>4.       </span>Are chairs adequately adjustable?

<span>5.       </span>Are there appropriate foot rest?

<span>6.       </span>Is there extra storage for better desk organization?






0 0
3 years ago
Write a program in Arduino IDE by using C++ and upload in EDVINO, creat two variables x and y. Intialize them with some value.Pr
Kryger [21]

Answer:

There's no clearly defined answer. Just follow the code I've written. I'm not fluent in C++, much more of JS or C#, but just follow this, hopefully you understand and you do your own homework next time.

Explanation:

int x, y; //defines variables

char name;

cout << "Type a number: ";

cin >> x;

cout << "Type another number: ";

cin >> y;

cout<< "Whats your name?";

cin>>name;

If(x>y){

cout<<name;

}else{

cout<<"Exit";

}

4 0
3 years ago
Other questions:
  • To access WordPad, Jill will click on Start, All Programs, Accessories, and WordPad. To access Notepad, Karl will click on Start
    11·1 answer
  • In an oligopolistic market, consumer choice is?
    12·2 answers
  • If you glare and grit your teeth while telling your friend that you're not frustrated, your nonverbal communication is _________
    6·1 answer
  • Working for the Internal Revenue Service is a career in public safety. A. True B. False
    14·1 answer
  • You are the CISO of a company and you need to create logging policies. Please review NIST SP800-92, specifically sections 4–3 th
    12·1 answer
  • What are the two basic categories of film
    5·1 answer
  • A single instruction carried out by a computer is called a what?
    5·1 answer
  • 1.a computer can create an output based on the input of the user.
    13·1 answer
  • Expressions provide an easy way to perform operations on data values to produce other data values. True False
    11·1 answer
  • Say true or false
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!