Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50cb9f0

Browse files
Merge pull request #46 from dsilva06/38-turples
changed readme
2 parents 06b3545 + b935b66 commit 50cb9f0

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# `38` Sort Tuples Ascending
2+
Debe escribir un programa para ordenar las tuplas (nombre, edad, altura) por orden ascendente donde el nombre es `string`, la edad y la altura son `números`.
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
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:
2-
1: Sort based on name;
3-
2: Then sort based on age;
4-
3: Then sort by score.
1+
# `38` Sort Tuples Ascending
2+
3+
4+
## :pencil: Instructions:
5+
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:
6+
7+
1. Sort based on name;
8+
2. Then sort based on age;
9+
3. Then sort by score.
510
The priority is that name > age > score.
611
If the following tuples are given as input to the program:
7-
Tom,19,80
8-
John,20,90
9-
Jony,17,91
10-
Jony,17,93
11-
Json,21,85
12-
Then, the output of the program should be:
13-
[('John', '20', '90'), ('Jony', '17', '91'), ('Jony', '17', '93'), ('Json', '21', '85'), ('Tom', '19', '80')]
12+
> - `Tom,19,80`
13+
> - `John,20,90`
14+
> - `Jony,17,91`
15+
> - `Jony,17,93`
16+
> - `Jason,21,85`
17+
18+
> - Then, the output of the program should be:
19+
`[('John', '20', '90'), ('Jony', '17', '91'), ('Jony', '17', '93'), ('Jason', '21', '85'), ('Tom', '19', '80')]`
1420

15-
Hints:
21+
## :bulb: Hint:
1622
In case of input data being supplied to the question, it should be assumed to be a console input.
1723
We use itemgetter to enable multiple sort keys.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /