PIXELBANKv8.2.1
Menu

Monthly Cost of a Running Instance

Problem Statement

Compute the monthly cost of an always-on instance given its hourly rate.

Background

A month is billed as hours_per_month = 730 hours (the cloud-standard average). Monthly cost is hourly_rate * 730 * instance_count.

Your Task

def monthly_cost(hourly_rate, instance_count):

Return the monthly cost, rounded to 2 decimals.

Input Format

  • hourly_rate (float), instance_count (int).

Output Format

  • A float rounded to 2 decimals.

Sample

print(monthly_cost(0.10, 3))

Output:

219.0

Example:

Input:
print(monthly_cost(0.10, 3))
Output:
219.0
Reasoning:

0.10 * 730 * 3 = 219.0.

Constraints:

  • Use 730 hours per month.
  • Cost = hourly_rate * 730 * instance_count.
  • Round to 2 decimals.
Editor

Test Results

0/0
Run code to see test results.
Monthly Cost of a Running Instance - Easy | PixelBank