โ“ Python Basics: Data Structures and Types Quiz ๐Ÿ

# You must make sure to run all cells in sequence using shift + enter or you might encounter errors
from pykubegrader.initialize import initialize_assignment

responses = initialize_assignment("1_quiz_2_q", "week_2", "quiz", assignment_points = 14.5, assignment_tag = 'week2-quiz')

# Initialize Otter
import otter
grader = otter.Notebook("1_quiz_2_q.ipynb")

โ“ Python Basics: Data Structures and Types Quiz ๐Ÿ#

# Run this block of code by pressing Shift + Enter to display the question
from questions._1_quiz_2_q import Question1
Question1().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._1_quiz_2_q import Question2
Question2().show()
# Run this block of code by pressing Shift + Enter to display the question
from questions._1_quiz_2_q import Question3
Question3().show()

Engine Performance Analysis ๐Ÿ”ง#

Instructions:#

Create a Python dictionary to analyze engine test data. Your solution must include:

  1. Create a dictionary named engine_data with these EXACT keys and values:

    • model: String โ€œV6-3000โ€

    • displacement: Float 3.0

    • test_temperatures: List [85, 90, 88, 92, 87] # in Celsius

    • performance_metrics: Dictionary containing:

      • horsepower: Float 280.5

      • torque: Float 350.8 # Nm

  2. Calculate these values (store each in its own variable):

    • avg_temp: Average of test_temperatures (use sum and len)

    • max_temp: Maximum temperature from test_temperatures (use max)

    • power_density: Horsepower divided by displacement

# Create the engine data dictionary with exact values
...


# Calculate required values
...

# We have provided the code to print the results for you
# Print results for verification (optional but helpful)
print(f"Average Temperature: {avg_temp:.1f}ยฐC")
print(f"Maximum Temperature: {max_temp}ยฐC")
print(f"Power Density: {power_density:.1f} hp/L")
grader.check("question-Engine-Data")

Submitting Assignment#

Please run the following block of code using shift + enter to submit your assignment, you should see your score.

from pykubegrader.submit.submit_assignment import submit_assignment

submit_assignment("week2-quiz", "1_quiz_2_q")