Convert the Temperature - Problem
Welcome to the Temperature Conversion Laboratory! 🌡️
You are given a non-negative floating point number representing the temperature in Celsius, rounded to two decimal places. Your task is to convert this temperature into both Kelvin and Fahrenheit scales.
Your Mission:
- Convert Celsius to Kelvin using:
Kelvin = Celsius + 273.15 - Convert Celsius to Fahrenheit using:
Fahrenheit = Celsius × 1.80 + 32.00 - Return both results as an array:
[kelvin, fahrenheit]
Example: If the input is 36.50 (normal human body temperature), you should return [309.65, 97.70]
Note: Answers within 10⁻⁵ of the actual answer will be accepted due to floating-point precision.
Input & Output
example_1.py — Room Temperature
$
Input:
celsius = 36.50
›
Output:
[309.65000, 97.70000]
💡 Note:
Human body temperature: 36.50°C converts to 309.65K (36.50 + 273.15) and 97.70°F (36.50 × 1.80 + 32.00)
example_2.py — Freezing Point
$
Input:
celsius = 0.00
›
Output:
[273.15000, 32.00000]
💡 Note:
Water freezing point: 0.00°C converts to 273.15K (absolute zero reference) and 32.00°F (standard freezing point)
example_3.py — Hot Summer Day
$
Input:
celsius = 122.11
›
Output:
[395.26000, 251.79800]
💡 Note:
Very hot temperature: 122.11°C converts to 395.26K and 251.798°F using the standard conversion formulas
Constraints
- 0 ≤ celsius ≤ 1000
- celsius will have exactly two decimal places
- Answers within 10-5 of the expected answer will be accepted
- Return format: Array of two floating-point numbers [kelvin, fahrenheit]
Visualization
Tap to expand
Understanding the Visualization
1
Celsius Input
We start with a temperature in Celsius, the most commonly used scale worldwide
2
Kelvin Conversion
Add 273.15 to shift from Celsius to the absolute temperature scale used in science
3
Fahrenheit Conversion
Multiply by 1.8 (9/5) and add 32 to convert to the scale used in the United States
4
Return Both
Package both converted temperatures into an array for the final result
Key Takeaway
🎯 Key Insight: Temperature conversion is a simple mathematical transformation - Kelvin uses an additive shift while Fahrenheit uses both scaling and shifting.
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code