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
EleoNora [17]
3 years ago
12

A loop that will output only the names that come before "Thor" in the alphabet from the names list.

Computers and Technology
1 answer:
matrenka [14]3 years ago
3 0

names = ["Kevin", "Joe", "Thor", "Adam", "Zoe"]

names.sort()

for x in names:

   if x == "Thor":

       break

   else:

       print(x)

I made up my own names for the sake of testing my code. I wrote my code in python 3.8. I hope this helps.

You might be interested in
Software that function as an electronic file cabinet
Airida [17]

Answer:

The answer to this question is "Document management software".

Explanation:

Document management software is software that provides a facility to stores data in an organized manner. It manages and tracks its electronic documents.

  • This software controls many fields, that are Storage location, Security and access control, Version control, etc.
  • It is a common component, that is found in an Enterprise Content Management environment, that uses this software.

7 0
3 years ago
Write a program that prompts for a positive integer and prints the factors of all integers from 1 to that input integer. For exa
xeze [42]
74(Frequency) or 34(frequency)
7 0
3 years ago
The first step in planning effective writing is to consider the _____. Audience Style Purpose Main Idea
spin [16.1K]

Answer:

The first step in planning effective writing is to consider your creativity

Explanation:

4 0
3 years ago
Nilsu is attempting to train a new administrative assistant on using a word processing program. Since the program is fairly comp
tatiyna

Answer:

teach the assistant bits and pieces of the program.

Explanation:

Given that the program is fairly complex and has many independent components, the most ideal way Nilsu should train a new administrative assistant on using a word processing program is by "teaching the assistant bits and pieces of the program."

This will make the administrative assistant understand and operate the program at a gradual pace without anhthing looking confusing.

5 0
2 years ago
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
2 years ago
Other questions:
  • When using a template to compose a memorandum which key on the keyboard moves the cursor to the next field
    15·1 answer
  • Which type of hypervisor does not run on an underlying operating system?
    13·1 answer
  • 3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
    15·2 answers
  • Explain motherboard in detail
    14·2 answers
  • Write a program to generate a square wave with 80% duty cycle on bit P2.7 Microprocessor.​
    7·1 answer
  • Hi guys, Im making a game. I want to make a collision event, but what is the code for making the wall and the box collide. I rea
    6·1 answer
  • If int a = 4, int *b = &amp;a , int **c= &amp;b;<br> what is the value store in c.
    15·1 answer
  • What are logic gates ?​
    10·2 answers
  • Rosanna is a middle school teacher. She has installed a spreadsheet program in her computer that tracks the grades and attendanc
    10·1 answer
  • Which is the fastest memory in computer​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!