Question

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 the user. 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:
ram,19,20
Shyam,15,67
Raju,13,90
Rakesh,17,78
Then, the output of the program should be:
[('Raju', '13', '90'), ('Rakesh', '17', '78'), ('Shyam', '15', '67'), ('ram', '19', '20')]

Answer

Get the step-by-step solution for this question inside the Vidyadip app.

Get the answer in the app

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a script to create a list of 10 random floating point numbers and then
(a) Find the mean of the elements present in the list (without using sum() function)
(b) Find the mean of all those elements of the list which are more than the mean calculated in 5c (above part of the question)
WAP to find the sum of first n terms of the following series:
$x+x^2+x^3+\ldots$
Write a menu driven program to do the following task:

1. Insert

2. Delete

3. Update

4. Display all

5. Search a Records

6. Create table

Describe Data Operations in Pandas.
Write the Pseudocode to sort the list using Insertion sort – to sort a list A in ascending order
Write a function search () to search a record in a binary file according to the student number entered by the user. Also display the message “Record not found” in case record not found in the file.
Write a program to create the list and ask user whether you want to add new element if say yes then add the element and print the new list else print the entered list.
Write algorithm for POP(Remove) operation in stack.
Consider the following DEPT and EMPLOYEE tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries
(v) to (viii).

Table: DEPT

DCODE DEPARTMENT LOCATION
D01 INFRASTRUCTURE DELHI
D02 MARKETING DELHI
D03 MEDIA MUMBAI
D05 FINANCE KOLKATA
D04 HUMAN RESOURCE MUMBAI

Table: EMPLOYEE

ENO NAME DOJ DOB GENDER DCODE
1001 George K 2013-09-02 1991-09-01 MALE D01
1002 Ryma Sen 2012-12-11 1990-12-15 FEMALE D03
1003 Mohitesh 2013-02-03 1987-09-04 MALE D05
1007 Anil Jha 2014-01-17 1984-10-19 MALE D04
1004 Manila Sahai 2012-12-09 1986-11-14 FEMALE D01
1005 R SAHAY 2013-11-18 1987-03-31 MALE D02
1006 Jaya Priya 2014-06-09 1985-06-23 FEMALE D05

Note: DOJ refers to date of joining and DOB refers to date of Birth of employees.

(i) To display Eno, Name, Gender from the table EMPLOYEE in ascending order of Eno.

(ii) To display the Name of all the MALE employees from the table EMPLOYEE.

(iii) To display the Eno and Name of those employees from the table EMPLOYEE who a born between ‘1987‐01‐01 ’and ‘1991‐12‐01 ’.

(iv) To count and display FEMALE employees who have joined after ‘1986‐01‐01 ’.

(v) Select count(*),dcode from employee group by dcode having count(*)>1;

(vi) Select distinct department from dept;

(vii) Select name, department from employee e, dept d where e.dcode=d.dcode and en0 <1003;

(viii) select max(doj), min(dob) from employee;

Write a script to create an empty list and then
(a) Input the names of 10 students and store them in the list using concatenation operator
(b) Display this list of names in reverse order