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]
3 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]3 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
You have implemented a network where each device provides shared files with all other devices, what kind of network is it?
Reil [10]

It is a Peer-to-peer type of network when you have implemented a network where each device provides shared files with all other devices.

So the answer is Peer-to-peer.

8 0
3 years ago
There are many opportunities for unscrupulous people to break information system security. Of the five components in an informat
7nadin3 [17]

The answer is letter e.

People is the component poses the very large ongoing security risk. It also can be a threat to the safety. People play an essential part in most operational systems and methods. Information, ability and mental outlook often determine the feature and quantity of system output. Just as a stereo requires the right component, high-performance business systems require the right fit of people to work.


8 0
3 years ago
Read 2 more answers
What is a half note + a 8th note in band? plz helppp
skad [1K]
One quarter note plus one eighth note equals one and a half beats. So a dotted quarter note lasts for one and a half beats.
3 0
3 years ago
Read 2 more answers
What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
Vlada [557]
They are Internet search engines.
7 0
4 years ago
Which of the following is NOT a feature of unclustered index
Lorico [155]

Answer:

C. Unclustered index has the same ordering of data records as that of the data entries in the database

Explanation:

Indexes are used to split up queries in an SQL server or database management system DBMS.

There are two types of indexes namely clustered indexed and unclustered indexes.

Clustered indexes define the order in which data is stored in a table while unclustered index does not sort the order in a table.

In an unclustered index, the data table and the index are stored in different places, they are easy to maintain and update since they do not follow a particular order and there can be several indexes in a data file since the data table is stored differently from the index file.

So, all the other options except C are features of unclustered indexes since  unclustered index does not have the same ordering of data records as that of the data entries in the database.

So, C is the answer.

3 0
3 years ago
Other questions:
  • The purpose of an experiment is often based on ? A. new theories B. observations C. opinions of famous scientists D. beliefs of
    10·1 answer
  • Consider the GBN protocol with a sender window size of 4 and a sequence number range of 1,024. Suppose that at time t, the next
    12·1 answer
  • ________ symbol is used in the "Advanced" section of the time range picker to round down to nearest unit of specified time.
    8·1 answer
  • There is no reason to study the works of famous photographers because they will make you less creative.
    5·2 answers
  • Discuss some design considerations that you should keep in mind when you want to design a professional-looking flyer or newslett
    5·2 answers
  • How many license plates are there if a license plate contains 3 letters from the 26 available in the English alphabet followed b
    15·1 answer
  • Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders.
    11·1 answer
  • Which type of information should never be given out on social media?
    5·2 answers
  • What are the impacts of mobile phone?as well as the positive and negative impacts?​
    5·1 answer
  • with the aid of your own example explain how memory,registers and secondary storage all work together​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!