120k views
2 votes
Analyzing Data Using Python ≪> Using the data from the pivot table in Part 1, complete the following tasks in Trinket: 1. Create three (3) lists - one to display the names of the licenses and other two to display the total domestic and total international sales for each of the licenses (Remember to enter the data with the appropriate data type) 2. Print the data type of the elements in each list. 3. Print the length, the min value, the max value and the sum of the elements in domestic sales list. 4. Create a Python statement that will answer the question: "Do international sales for PG-13 movies gross more than all the other movies combined?" Submission: Submit the Trinket URL created in the "Text Submission" area for this assignment. (To get the Trinket URL: Go to the "Share" menu in Trinket and select "Link". Copy and paste the link in Blackboard.)

User Dreta
by
7.4k points

1 Answer

5 votes

Final answer:

To analyze data with Python, create lists for your data, print data types, and calculate length, min, max, and sum for a list. Then, use a comparison to evaluate a specific condition regarding international sales.

Step-by-step explanation:

To analyze data using Python, you can follow these steps:

  1. Create lists to hold your data for licenses, domestic sales, and international sales.
  2. Use the type function to print the data type of the elements in each list.
  3. Print the length of the domestic sales list using the len function, and use the min, max, and sum functions to print the respective minimum, maximum, and sum of the list.
  4. Write a Python statement to determine if international sales for PG-13 movies are greater than the combined sales of other movies. This can be done using a comparison operator and the sum function.

Here is an example of how this might look in Python:


licenses = ['G', 'PG', 'PG-13', 'R']
# Assuming these are the total sales for each license type
# Replace these example numbers with your actual data


# Check if international sales for PG-13 movies gross more than all other movies combined
print(international_sales[2] > sum(domestic_sales) + sum(international_sales) - international_sales[2])

In the above Python code, you should replace the placeholder lists with the actual data from your pivot table. The final print statement will output True or False depending on whether the condition is met.

User Kevin Schmid
by
8.6k points