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
Ronch [10]
2 years ago
6

Write a program to sort the (name, age, score) tuples by descending order where name is string, age and score are numbers. The s

ort criteria is: 1: Sort based on name 2: Then sort based on age 3: Then sort by score The priority is that name < age < score. If the following tuples are given as input to the program: [('John', '20', '91'), ('Jason', '21', '85'), ('Jony', '17', '91'), ('Johny', '17', '93'), ('Tom', '19', '80')]\
Computers and Technology
1 answer:
zimovet [89]2 years ago
6 0

Answer:

The program in Python is as follows:

from operator import itemgetter

m = int(input("Number of records: "))

print("Name, Age, Score")

my_list =[]

for i in range(m):

   user_details = input()

   my_list.append(tuple((user_details.split(","))))

my_list.sort(key =  itemgetter(0, 1, 2))        

print("Sorted: ", my_list)

Explanation:

This imports the operator function from itemgetter

from operator import itemgetter

This gets the number of records, m

m = int(input("Number of records: "))

This prints the format of input

print("Name, Age, Score")

This initializes the list of tuples

my_list =[]

This iterates through m

for i in range(m):

This gets the details of each person

   user_details = input()

This appends the details to the tuple

   my_list.append(tuple((user_details.split(","))))

This sorts the tuple

my_list.sort(key =  itemgetter(0, 1, 2))        

This prints the sorted tuple

print("Sorted: ", my_list)

You might be interested in
How does the team know what to work upon during the iteration
Brilliant_brown [7]

Answer:

Based on the discussions during iteration planning, team members agree on what each would work on.

Explanation:

Iteration can be defined as the way in which a process is been repeated in order to generate a possibly outcomes and this occur in a situation where the sequence will approach some end point in which each repetition of the process will be a single iteration while the outcome of each iteration will then be the starting point of the next iteration.

Therefore the team know what to work upon during the iteration Base on the discussions during iteration planning in which the team members agree on what each of them would work on.

During the iteration planning, the team collectively make a decision on how much of the backlog actually they will commit to the iteration in which the committed backlog then is taken to the delivery during the next iteration which is why the goals or objectives of the iteration get determined on the basis of the work committed.

7 0
3 years ago
Assume that name and age have been declared suitably for storing names (like "abdullah", "alexandra" and "zoe") and ages respect
schepotkina [342]

Answer:

Explanation:

It is assumed that name and age have been declared suitably for storing names and ages. so the following is the code to read in a name  and age and printout the message "the age of name is age. "

cin >> Name;

cin >> Age;

cout << "The age of " << Name << " is " << Age << ".";

7 0
3 years ago
Why would you want to minimize the Ribbon?
Yakvenalex [24]

Answer:

When the Ribbon is minimized, you see only the tabs. There is no way to delete or replace the Ribbon with the toolbars and menus from the earlier versions of Microsoft Office. However, you can minimize the Ribbon to make more space available on your screen.

7 0
3 years ago
If Word finds a potential error in a document, a red, green, or blue wavy underline flags the problem.
dlinn [17]
As for this problem of true or false, the most probable answer the most likely one to be the correct answer would be A. True.

In Microsoft Word, or commonly referred to as MS Word, or simply Word itself as what is utilized in the problem, the program has the ability to recognize in spelling and grammar. When a red wavy underline is present, the word or words above it are usually wrong in spelling. Though this can be corrected by the user by adding the word in the dictionary so as not to be corrected in the future. The green one would be more about grammar. The blue wavy underline would indicate a word spelled correctly, but might be misused in the sentence it belongs. This usually happens to words that are almost identical in spelling like too and to.
8 0
3 years ago
When are numbered lists generally used?
laiz [17]
<span>C. when listing items that have an order of priority </span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • If your DTP document contains watermarks on every page, where can you place them?
    13·2 answers
  • In mathematics, the factorial of a positive integer n, denoted as n! , is the product of all positive integers less than or equa
    10·2 answers
  • Question 14. (3.04 MC) how does the project manager evaluate the scope of a project
    14·1 answer
  • The Internet may best be compared to a/an
    8·1 answer
  • Populate a one-dimensional array with the following grades in this order: 90, 61, 74, 42, 83, 51, 71, 83, 98, 87, 94, 68, 44, an
    15·1 answer
  • Analog signals consists of individual electric pulses that represents bits group together into bytes {True/False}
    13·1 answer
  • The Mail Merge option is located in which tab? a;home b;insert c;refernces d;mailings
    11·2 answers
  • Select the education and qualifications that are most helpful for business analysis careers. Check all that apply
    11·2 answers
  • Defination of formula work sheet​
    15·1 answer
  • The Western Siberian Plain is __________ in some places because it has poor natural draining systems.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!