-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssignment 35.py
41 lines (23 loc) · 903 Bytes
/
Assignment 35.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#You are required to write a program to sort the (name, age, height) tuples by ascending order
# where name is string, age and height are numbers. The tuples are input by console. The sort 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:
# Tom,19,80
# John,20,90
# Jony,17,91
# Jony,17,93
# Json,21,85
# Then, the output of the program should be:
# [('John', '20', '90'), ('Jony', '17', '91'), ('Jony', '17', '93'), ('Json', '21', '85'),('Tom', '19', '80')]
from numpy import sort
det=[('John', '90','20'), ('17','Jony', '91'), ('Jony', '17', '93'), ('Json', '21', '85'),('Tom', '19', '80')]
sorted(det)
for i in det:
j=list(i)
sorted(j)
print (j)
# for j in i:
# print(j)