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
jeyben [28]
3 years ago
14

Task1: #Define a function called show_students which takes 2 parameters students and message #Print out a message, and then the

list of students #Next, put the students in alphabetical order and print them #Next, Put students in reverse alphabetical order and print them Example Output: Our students are currently in alphabetical order. - Aaron - Bernice - Cody Our students are now in reverse alphabetical order. - Cody - Bernice - Aaron
Computers and Technology
1 answer:
k0ka [10]3 years ago
6 0

Answer:

  1. def show_students(message, sList):
  2.    print(message)
  3.    print(sList)
  4.    print("Our students are currently in alphabetical order")
  5.    sList.sort()
  6.    output = ""
  7.    for student in sList:
  8.        output += "-" + student
  9.    print(output)
  10.    print("Our students are currently in reverse alphabetical order")
  11.    sList.sort(reverse=True)
  12.    output = ""
  13.    for student in sList:
  14.        output += "-" + student
  15.    print(output)  
  16. show_students("Welcome to new semester!", ["Aaron","Bernice", "Cody"])

Explanation:

Firstly we declare a function that will take two inputs, message and student list (Line 1).

In the function, we first print the message and the original input student list (Line 2 - 3). Next, we use sort method to sort the input list and then output the sorted items from the list using a for loop (Line 5-10).

Next, we sort the list again by setting reverse = True and this will sort the list in descending order (Line 13). Again we use the similar way mentioned above to output the sorted items (in descending order) using a for loop (Line 14 -17)

We test the function using a sample student list (Line 18) and we shall get the output:

Welcome to new semester!

['Aaron', 'Bernice', 'Cody']

Our students are currently in alphabetical order

-Aaron-Bernice-Cody

Our students are currently in reverse alphabetical order

-Cody-Bernice-Aaron

You might be interested in
Can someone help me with this please
alex41 [277]

Answer:

D

Explanation:

Filters and the Sort feature can be applied in any order. 

4 0
2 years ago
If you were an online community director, you might use both chat and e-mail in your community. What are some similarities and d
stealth61 [152]

Emails are formal

Online chats are private and friendly

Emails are used for business

Online chats are for friends

5 0
3 years ago
Which option helps you choose the design of a slide in a presentation A) slide layout b) shapes c) animation d) slide transition
mihalych1998 [28]

Answer:

B) slide layout

Explanation:

Slide layout, since you can choose what type of design you want, I'm guessing this is for power point.

8 0
3 years ago
Read 2 more answers
Which would be the best and worst answer choices?
jeyben [28]

Answer:

option 3

Explanation:

4 0
3 years ago
A programmer has an idea to use just one language for the content, structure, and style of web pages. What might be a problem wi
Juliette [100K]
Doesn’t give the programmer a lot of freedom to be creative. Using only one language on the web limits the amount features the programmer could create.

For example, just only using HTML limits the web page’s features to use scripts like Javascripts.
8 0
3 years ago
Other questions:
  • A Windows systems administrator should use the Administrator account ________.a. As little as possible, and only when needed b.
    15·1 answer
  • When inserting a fly in animation what is the first step in the process?
    9·1 answer
  • What will the following segment of code output? Assume the user enters a grade of 90 from the keyboard. cout << "Enter a t
    5·1 answer
  • Explain the iterative nature of the database requirements collection, definition, and visualization process.
    14·1 answer
  • Write a flowchart and program that does the following: Asks the user for the average temperature in each of the last 12 months A
    12·1 answer
  • Am I going to ever go back to school?
    12·2 answers
  • What is the difference between a crosstab query and a subquery?
    11·2 answers
  • Match each role to the corresponding web development task.
    14·1 answer
  • Key Vocabulary:
    7·1 answer
  • Need help not sure if I’m correct
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!