Skip to content
Open
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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Department of Climate, Meteorology & Atmospheric Sciences

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
188 changes: 188 additions & 0 deletions Module_1_Part_2_Makowski.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "58240e24",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Temperature Conversion Tool.\\n\\nThis program prompts the user for a temperature in Fahrenheit,\\nconverts it to Celsius and Kelvin using a function, and then\\nprints the results.\\n'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"Temperature Conversion Tool.\n",
"\n",
"This program prompts the user for a temperature in Fahrenheit,\n",
"converts it to Celsius and Kelvin using a function, and then\n",
"prints the results.\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ee4cf849",
"metadata": {},
"outputs": [],
"source": [
"def fahrenheit_to_celsius_kelvin(fahrenheit: float) -> tuple[float, float]:\n",
" \"\"\"Convert Fahrenheit temperature to Celsius and Kelvin.\n",
"\n",
" Args:\n",
" fahrenheit (float): Temperature in degrees Fahrenheit.\n",
"\n",
" Returns:\n",
" tuple[float, float]: Converted temperatures in Celsius and Kelvin.\n",
" \"\"\"\n",
" celsius = (fahrenheit - 32) * 5 / 9\n",
" kelvin = celsius + 273.15\n",
" return celsius, kelvin"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "dbf4afbf",
"metadata": {},
"outputs": [],
"source": [
"# Request user input\n",
"fahrenheit_input = float(input(\"Enter temperature in Fahrenheit: \"))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ac297bb3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Input Temperature: 212.00 °F\n",
"Converted to Celsius: 100.00 °C\n",
"Converted to Kelvin: 373.15 K\n"
]
}
],
"source": [
"# Perform conversion\n",
"celsius_output, kelvin_output = fahrenheit_to_celsius_kelvin(fahrenheit_input)\n",
"\n",
"# Display results\n",
"print(f\"\\nInput Temperature: {fahrenheit_input:.2f} °F\")\n",
"print(f\"Converted to Celsius: {celsius_output:.2f} °C\")\n",
"print(f\"Converted to Kelvin: {kelvin_output:.2f} K\")"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b81dffde",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Temperature Conversion Tool.\\n\\nThis program prompts the user for a temperature in Celsius,\\nconverts it to Fahrenheit and Kelvin using a function, and then\\nprints the results.\\n'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"Temperature Conversion Tool.\n",
"\n",
"This program prompts the user for a temperature in Celsius,\n",
"converts it to Fahrenheit and Kelvin using a function, and then\n",
"prints the results.\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "5bc14a1b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Input Temperature: 100.00 °C\n",
"Converted to Fahrenheit: 212.00 °F\n",
"Converted to Kelvin: 373.15 K\n"
]
}
],
"source": [
"def celsius_to_fahrenheit_kelvin(celsius: float) -> tuple[float, float]:\n",
" \"\"\"Convert Celsius temperature to Fahrenheit and Kelvin.\n",
"\n",
" Args:\n",
" celsius (float): Temperature in degrees Celsius.\n",
"\n",
" Returns:\n",
" tuple[float, float]: Converted temperatures in Fahrenheit and Kelvin.\n",
" \"\"\"\n",
" fahrenheit = (celsius * 9 / 5) + 32\n",
" kelvin = celsius + 273.15\n",
" return fahrenheit, kelvin\n",
"\n",
"\n",
"# Request user input\n",
"celsius_input = float(input(\"Enter temperature in Celsius: \"))\n",
"\n",
"# Perform conversion\n",
"fahrenheit_output, kelvin_output = celsius_to_fahrenheit_kelvin(celsius_input)\n",
"\n",
"# Display results\n",
"print(f\"\\nInput Temperature: {celsius_input:.2f} °C\")\n",
"print(f\"Converted to Fahrenheit: {fahrenheit_output:.2f} °F\")\n",
"print(f\"Converted to Kelvin: {kelvin_output:.2f} K\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac301814",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
# Create a README.md
# Temperature Conversion Tool

If you need help with `Markdown`, check out [The Markdown Cheatsheet](https://www.markdownguide.org/cheat-sheet/)!
This project is a simple Python 3 program (developed in Jupyter Notebook) that converts temperatures between **Fahrenheit, Celsius, and Kelvin**. It demonstrates the use of functions, user input, and formatted output while following **PEP 8** (style guide) and **PEP 257** (docstring conventions).

What should a good README.md look like? Check out these [guidelines](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes).
## Features

Did you add an open source software license?
- **Main Branch**
- Converts a user-provided **Fahrenheit** value into Celsius and Kelvin.

- **Feature Branch**
- Adds functionality to accept a **Celsius** input and convert it to Fahrenheit and Kelvin.

## Learning Goals

This project was created as part of a GitHub workflows exercise:
1. Write simple, well-documented Python code.
2. Create a new branch for added functionality.
3. Commit and push changes using GitHub Codespaces.
4. Open a Pull Request (PR) and merge into `main`.

## Usage

1. Open the notebook file in your Codespace or local environment.
2. Run the program and enter a temperature value when prompted.
3. The program will display the converted values in the other temperature units.

Example (Celsius input branch):

Enter temperature in Celsius: 25

Input Temperature: 25.00 °C
Converted to Fahrenheit: 77.00 °F
Converted to Kelvin: 298.15 K

## Requirements

- Python 3.8+
- Jupyter Notebook (optional, if running interactively)

## License

This project is licensed under the terms of the **MIT License**.
See the [LICENSE](LICENSE) file for details.