Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Temperature_Converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 🌡️ Temperature Converter

A simple and interactive Python program to convert temperatures between **Celsius**, **Fahrenheit**, and **Kelvin**.

## 🚀 Features
- Convert between all major temperature units
- Clean and easy-to-use CLI interface
- Accurate conversion formulas

## 🧩 How to Run
```bash
python temperature_converter.py
```

## 📖 Example
```
🌡️ Temperature Converter
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Celsius to Kelvin
4. Kelvin to Celsius
5. Fahrenheit to Kelvin
6. Kelvin to Fahrenheit
Enter choice (1–6): 1
Enter Celsius: 25
25°C = 77.00°F
```

---

✅ **Simple. Accurate. Handy.**
62 changes: 62 additions & 0 deletions Temperature_Converter/temperature_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Temperature Converter
# Converts temperature between Celsius, Fahrenheit, and Kelvin

def celsius_to_fahrenheit(celsius):
return (celsius * 9 / 5) + 32


def fahrenheit_to_celsius(fahrenheit):
return (fahrenheit - 32) * 5 / 9


def celsius_to_kelvin(celsius):
return celsius + 273.15


def kelvin_to_celsius(kelvin):
return kelvin - 273.15


def fahrenheit_to_kelvin(fahrenheit):
return (fahrenheit - 32) * 5 / 9 + 273.15


def kelvin_to_fahrenheit(kelvin):
return (kelvin - 273.15) * 9 / 5 + 32


def main():
print("🌡️ Temperature Converter")
print("1. Celsius to Fahrenheit")
print("2. Fahrenheit to Celsius")
print("3. Celsius to Kelvin")
print("4. Kelvin to Celsius")
print("5. Fahrenheit to Kelvin")
print("6. Kelvin to Fahrenheit")

choice = input("Enter choice (1–6): ")

if choice == "1":
c = float(input("Enter Celsius: "))
print(f"{c}°C = {celsius_to_fahrenheit(c):.2f}°F")
elif choice == "2":
f = float(input("Enter Fahrenheit: "))
print(f"{f}°F = {fahrenheit_to_celsius(f):.2f}°C")
elif choice == "3":
c = float(input("Enter Celsius: "))
print(f"{c}°C = {celsius_to_kelvin(c):.2f}K")
elif choice == "4":
k = float(input("Enter Kelvin: "))
print(f"{k}K = {kelvin_to_celsius(k):.2f}°C")
elif choice == "5":
f = float(input("Enter Fahrenheit: "))
print(f"{f}°F = {fahrenheit_to_kelvin(f):.2f}K")
elif choice == "6":
k = float(input("Enter Kelvin: "))
print(f"{k}K = {kelvin_to_fahrenheit(k):.2f}°F")
else:
print("Invalid choice ❌")


if __name__ == "__main__":
main()
Loading