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
Jet001 [13]
3 years ago
15

5.16 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The in

put begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain less than 20 integers. Ex: If the input is: 5 2 4 6 8 10 the output is: 10 8 6 4 2 To achieve the above, first read the integers into an array. Then output the array in reverse.
Computers and Technology
2 answers:
Schach [20]3 years ago
6 0

Answer:

The solution code is written in Python 3

  1. num_input = input("Enter a list of number: ")
  2. num_list = num_input.split(" ")
  3. output = ""
  4. for i in range(len(num_list) -1, 0, -1):
  5.    output += num_list[i] + " "
  6. print(output)

Explanation:

Firstly, use the input function to prompt user to enter a list of number in a single string (Line 1).

Next, use the split method to convert the input string into a list of individual numbers using single space as delimiter (Line 2).

Use a for loop and start the iteration from the last element in the list (Line 5) and then join the element to the output string followed with a single space (Line 5-6).

After completing the loop, we print the output string (Line 8).

svet-max [94.6K]3 years ago
6 0

Answer:

integers = []

while True:

      number = int(input("Enter integers (Enter negative number to end) "))

      if number < 0:

         break

      integers.append(number)  

print ("The smallest integer in the list is : ", min(integers))

print("The largest integer in the list is : ", max(integers))

Explanation:

You might be interested in
Problem 4 (3 pts): Let n be a positive integer. Show that among any group of n 1 (not necessarily consecutive) positive integers
konstantin123 [22]

Answer:There are two integers in the group of n+1 integers with exactly the same remainder when they are divided by n.

Explanation:

Generally, if a number is divided by p(positive integer), then the possible remainders will be from 0 to p-1.

Here, the possible remainders when an integer is divided by n are 0,1,....,n-1

so the number of possible remainders when an integer is divided by n is n.

In this case, the number of objects is n+1 integers and the number of boxes (remainders) is n.

p/k = (n+1)/n

= 1+(1/n)

= 2

Here, 0<1/n<1

Add 1 on both sides to get the following

0+1 < 1+1/n<1+1

1<1+1/n<2

so the value of p/k = 2 means that there is atleast one remainder which is same for two integers when they are divided by n

There are therefore two integers in the group of n+1 integers with exactly the same remainder when they are divided by n.

3 0
4 years ago
You are the IT Administrator for the CorpNet.local domain. You are in the process of implementing a group strategy for your netw
Allisa [31]

Answer:

1. Select Tools then Active Directory Users from the Server Manager

2. Navigate to the relevant Organizational Unit, OU, in the Active Directory

3. Select New then Group in the OU in which a global securities group is to be created

4. The group name (Accounting, Research-Dev, or Sales) is entered into the Group name field

5. Select the scope of the group

6. The group type is then selected (Domain Local, Global, or Universal)

7. The user accounts are then added to the group as follows;

i) Selecting the Add to a group option after right clicking a user account

ii) Enter the name of the appropriate group in the field to Enter the object names to select

iii) A group scope and group type is then selected

iv) Click on Check names

v) Other users can be added to the group by repeating steps i), ii), iii), and iv)

8) To add additional users to the group, the step 6, 7, and 8 is to be repeated

Explanation:

7 0
3 years ago
18. which of these components is responsible for providing instructions and processing for a computer? a. cpu b. ssd c. ram d. r
cricket20 [7]

The components that is responsible for providing instructions and processing for a computer is a. CPU.

<h3>What area of the computer executes commands?</h3>

This command center's central processing unit (CPU) is a sophisticated, large-scale collection of electrical circuitry that carries out pre-stored program instructions. A central processing unit is a must for all computers, big and small.

Note that the CPU, RAM, and ROM chips are all located on the motherboard. The "brain" of the computer is known as the Central Processing Unit (CPU). It carries out instructions (from software) and directs other parts.

Learn more about CPU from

brainly.com/question/26991245
#SPJ1

7 0
1 year ago
Consider an interface p ublic interface NumberFormatter { String format (in n); } Provide four classes that implement this inter
sesenic [268]

Answer and Explanation:

Here is the code for the question with output.

public interface NumberFormatter {

  public String format(int n);

}

class DefaultFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.valueOf(n);

  }

}

class DecimalFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.format("%,d",n); //formats the number by putting comma for 3 digits

  }

}

class AccountingFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.format("(%d)",n);

  }

}

class BaseFormatter implements NumberFormatter

{

  int base;

 

  public BaseFormatter(int b)

  {

         

      base = b;

      if(base < 2 || base > 36) //if values out of range 2-36 inclusive are given, set default to 2

          base = 2;

  }

  public String format(int n)

  {

      return Integer.toString(n, base);      

  }

  int getBase()

  {

      return base;

  }

}

public class TestNumberFormatter {

  private static void print(int n, NumberFormatter formatter)

  {

      String s = String.format("%15s",formatter.format(n));

      System.out.print(s);

  }

  public static void main(String[] args) {

      int numbers[]= {100,55555,1000000,35,5};

      DefaultFormatter defFmt = new DefaultFormatter();

      DecimalFormatter deciFmt = new DecimalFormatter();

      AccountingFormatter accFmt = new AccountingFormatter();

      BaseFormatter baseFmt=new BaseFormatter(16) ; //base 16

      String s;

     

      System.out.println("\tDefault \t Decimal \tAccounting \t Base("+baseFmt.getBase()+")");

      for(int i = 0; i < numbers.length; i++)

      {

          print(numbers[i], defFmt);

          print(numbers[i], deciFmt);

          print(numbers[i], accFmt);

          print(numbers[i], baseFmt);

          System.out.println();//new line

      }

     

  }

}

output

  Default    Decimal    Accounting    Base(16)

100 100 (100) 64

55555 55,555 (55555) d903

1000000 1,000,000 (1000000) f4240

  35 35 (35) 23

5 5 (5) 5

3 0
3 years ago
1. Which of the following cables are used in networking? Check all that apply.
Rudik [331]

Answer:

ethernet and HDMI for sure those 2

Explanation:

^

8 0
3 years ago
Read 2 more answers
Other questions:
  • A spreadsheet program of a computerized version of _______
    14·1 answer
  • *Could someone please help me with this***
    5·1 answer
  • Does the following program represent an algorithm in the strict sense? Why or why not? Count=0 while count (count ! =5): count =
    13·1 answer
  • Which of the following are examples of how a company might use consumer data it had collected? a To decide what types of product
    10·1 answer
  • The purpose of validating the results of the program is Group of answer choices To create a model of the program To determine if
    12·1 answer
  • Visual Design includes 4 elements: shapes, texture, lines and form.
    6·1 answer
  • Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of ti
    12·1 answer
  • Select each of the tasks that you could complete using a word processor.
    5·2 answers
  • Which wireless specification can connect to a school's WLAN and connect to multimedia display projectors wirelessly?
    7·1 answer
  • Guys is there a way to watch manga in colour for free
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!