
Problem
Solution
Submissions
Convert Celsius to Fahrenheit
Certification: Basic Level
Accuracy: 68.98%
Submissions: 332
Points: 5
Write a Python program that converts a temperature in Celsius to Fahrenheit.
Example 1
- Input: 0
- Output: 32.0
- Explanation:
- Step 1: Apply the formula F = (C × 9/5) + 32.
- Step 2: F = (0 × 9/5) + 32 = 0 + 32 = 32.0.
- Step 3: Return 32.0 as the result.
Example 2
- Input: 37
- Output: 98.6
- Explanation:
- Step 1: Apply the formula F = (C × 9/5) + 32.
- Step 2: F = (37 × 9/5) + 32 = 66.6 + 32 = 98.6.
- Step 3: Return 98.6 as the result.
Constraints
- -273.15 ≤ celsius ≤ 10^6 (temperature above absolute zero)
- Time Complexity: O(1)
- Space Complexity: O(1)
Editorial
My Submissions
All Solutions
Lang | Status | Date | Code |
---|---|---|---|
You do not have any submissions for this problem. |
User | Lang | Status | Date | Code |
---|---|---|---|---|
No submissions found. |
Solution Hints
- Use the formula: fahrenheit = (celsius * 9/5) + 32
- Use lambda function: convert = lambda c: (c * 9/5) + 32
- Use multiplication by 1.8 instead of 9/5: fahrenheit = (celsius * 1.8) + 32