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
ser-zykov [4K]
4 years ago
10

Write a function named "sort_by_product" that takes a list/array of lists/arrays as a parameter where each of the values of inpu

t is a list containing 6 floating point numbers. Sort the input based on multiplication of the sixth and second values in each list
Computers and Technology
1 answer:
vladimir2022 [97]4 years ago
3 0

Answer:

Following are the program in the Python Programming Language:

def sort_by_product(products): #define function

   products.sort(key=lambda x: x[4] * x[1]) #solution is here

   return products  #return products

#set list type variable

product = [  

   [1, 2, 9, 1, 1, 2],

   [1, 7, 9, 9, 7, 2],

   [1, 1, 9, 5, 2, 2],

   [1, 5, 9, 4, 6, 2],

]

sort_by_product(product)  #call function

print(product)  #print result

Explanation:

Here, we define function "sort_by_product" and pass an argument inside it.

  • inside the function we sort the list and writr the following solution in it.
  • we return the value of products

Then, we set the list type variable 'product' then, call the function.

You might be interested in
What is an IF statement used for?
kiruha [24]

The IF statement is a decision-making statement that guides a program to make decisions based on specified criteria. The IF statement executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.

8 0
3 years ago
Consider the following relation:CAR_SALE(Car#, Date_sold, Salesperson#, Commission%, Discount_amt)Assume that a car may be sold
GalinKa [24]

Answer:

The answer to this question can be given as:

Normalization:

Normalization usually includes the division of a table into two or more tables as well as defining a relation between the table. It is also used to check the quality of the database design. In the normalization, we use three-level that are 1NF, 2NF, 3NF.

First Normal Form (1NF):

In the 1NF each table contains unique data. for example employee id.  

Second Normal Form (2NF):

In the 2NF form, every field in a table that is not a determiner of another field's contents must itself be a component of the table's other fields.

Third Normal Form (3NF):

In the 3NF form, no duplication of information is allowed.

Explanation:

The explanation of the question can be given as:

  • Since all attribute values are single atomic, the given relation CAR_SALE is in 1NF.  
  • Salesperson# → commission% …Given  Thus, it is not completely dependent on the primary key {Car#, Salesperson#}. Hence, it is not in 2 NF.                                                                                                        

The 2 NF decomposition:

        CAR_SALE_1(Car#, Salesperson#, Date_sold, Discount_amt)

         CAR_SALE_2(Salesperson#, Commission%)

  • The relationship in question is not in 3NF because the nature of a transitive dependence occurs
  • Discount_amt → Date_sold → (Car#, Salesperson#) . Thus, Date_sold is neither the key itself nor the Discount amt sub-set is a prime attribute.  

The 3 NF decomposition :

        CAR_SALES_1A(Car#, Salesperson#, Date_sold)

        CAR_SALES_1B(Date_sold, Discount_amt)

        CAR_SALE_3(Salesperson#, Commission%)

5 0
3 years ago
Write a switch statement that tests the value of the char variable response and performs the following actions: if response is y
kirill [66]

// Here is the required switch statement on response character

switch(response){

case 'y': // case to check if the response is y

cout<<" Your request is being processed ";

case 'n': // case to check for n

cout<<" Than you, anyway for your consideration";

case 'h': // case to check for h

cout<<"Sorry \, no help is currently available.";

default : // default case

cout<< Invalid entry: please try again.";

}

6 0
3 years ago
Xcode, Swift, and Appy Pie are all tools for doing what?
joja [24]

Answer:

creating smartphone apps

Explanation:

Xcode, Swift, and Appy Pie are all tools for creating iOS applications.

These tools are used for app development in the iOS platform which is a rival to the Android platform.

They are used to build the apps from scratch, develop and test them,

4 0
4 years ago
Read 2 more answers
Windows service accounts will use passwords consisting of at least
KonstantinChe [14]
<span>Windows service accounts will use passwords consisting of at least 15 characters</span>
7 0
4 years ago
Other questions:
  • WILL GIVE BRAINLIEST!!!!!!!!
    6·1 answer
  • Rich Text Format (RTF) is a universal file format that can include information such as text style, size, and color and can be re
    12·2 answers
  • Give two separate print statements: one will print your name, the other will print your major. Ensure that both will print on th
    15·1 answer
  • Jim maintains attendance records for his employees for the year. Row B includes the dates of attendance, and column A includes t
    5·2 answers
  • Which of the following is a software application program?
    12·1 answer
  • one_diff(a?): Description: Determine if there is exactly one character different between exactly two strings. Parameters: Determ
    5·1 answer
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
  • A network administrator is importing a list of certificates from an online source, so that employees can use a chain of trust an
    10·1 answer
  • Which term refers to a shorthand method for identifying network and host bits in an ip address?
    14·1 answer
  • Find the name of the professor with the maximum percentage of students that failed his course.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!