Answer:
- def show_students(message, sList):
- print(message)
- print(sList)
-
- print("Our students are currently in alphabetical order")
- sList.sort()
- output = ""
- for student in sList:
- output += "-" + student
- print(output)
-
- print("Our students are currently in reverse alphabetical order")
- sList.sort(reverse=True)
- output = ""
- for student in sList:
- output += "-" + student
- print(output)
-
- 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
Answer:
Option A is the correct answer for the above question
Explanation:
The object is used to take memory for the class member and functions because the class is the only structure which defines the types of the member for that class. The class object is used to reference a member of the class. The object of the class is known as an instance of the class and the one object variables value is different from the other objects variable value for the same class. So the object is used to holds the instance field because the object is used to initialize the value of the variable of the class. So the attributes associated with the class object can be called the instance field . The above question also asked the same and the answer is Instance field which is stated from the option A. Hence Option A is the correct answer while the other is not because--
- Option B states about instance method which refers to the method of a class for which that object is created.
- Option C states about the fixed attributes which are not the correct answer.
- Option D states about class instances which refer to the object of the class.
Answer:
1. If there is a big table or picture needed to show in a single paper.
2. For showing differences between two things.
3. To have more words to fit in a paper
Explanation:
C because you already have you sheet prepared