Celsius to Fahrenheit Conversions by karimzakir02 · Pull Request #2188 · TheAlgorithms/Python · GitHub
Skip to content

Celsius to Fahrenheit Conversions - #2188

Merged
cclauss merged 15 commits into
TheAlgorithms:masterfrom
karimzakir02:celsius_to_fahrenheit
Jul 15, 2020
Merged

cclauss merged 15 commits into
TheAlgorithms:masterfrom
karimzakir02:celsius_to_fahrenheit

Conversation

@karimzakir02

@karimzakir02 karimzakir02 commented Jul 8, 2020

Copy link
Copy Markdown
Contributor

Describe your change:

Added two algorithms to convert between Celsius and Fahrenheit

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@TravisBuddy

Copy link
Copy Markdown

@TravisBuddy

Copy link
Copy Markdown

Hey @karimzakir02,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 47d937a0-c14a-11ea-9c30-6301f8ea01dd

@TravisBuddy

Copy link
Copy Markdown

Hey @karimzakir02,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: f56d7cd0-c14c-11ea-9c30-6301f8ea01dd

@TravisBuddy

Copy link
Copy Markdown

Hey @karimzakir02,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: f3cc3e00-c14e-11ea-9c30-6301f8ea01dd

@TravisBuddy

Copy link
Copy Markdown

Hey @karimzakir02,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: e3274440-c14f-11ea-9c30-6301f8ea01dd

Comment thread conversions/fahrenheit_to_celsius.py Outdated
Comment thread conversions/fahrenheit_to_celsius.py Outdated
Comment thread conversions/fahrenheit_to_celsius.py Outdated
Comment thread conversions/fahrenheit_to_celsius.py Outdated

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why round() in one algorithm but not in the other?

Comment thread conversions/celsius_to_fahrenheit.py Outdated
Comment thread conversions/celsius_to_fahrenheit.py Outdated
Comment thread conversions/fahrenheit_to_celsius.py Outdated
Comment thread conversions/celsius_to_fahrenheit.py Outdated
Comment thread conversions/celsius_to_fahrenheit.py Outdated
Comment thread conversions/celsius_to_fahrenheit.py Outdated
Comment thread conversions/fahrenheit_to_celsius.py Outdated
Comment on lines 25 to 26
fahrenheit = float(fahrenheit)
return round((fahrenheit - 32) * 5 / 9, 2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fahrenheit = float(fahrenheit)
return round((fahrenheit - 32) * 5 / 9, 2)
return round((float(fahrenheit) - 32) * 5 / 9, 2)

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should put both algorithms in a single file: celsius_fahrenheit.py or we could call it temperatures.py to leave room for Kelvins, and friends. https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature

@TravisBuddy

Copy link
Copy Markdown

Hey @karimzakir02,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 568b3a70-c5bc-11ea-9068-c57c6eb78cd5

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thanks for doing this.

@karimzakir02

Copy link
Copy Markdown
Contributor Author

@cclauss
cclauss merged commit 88e82db into TheAlgorithms:master Jul 15, 2020
@karimzakir02
karimzakir02 deleted the celsius_to_fahrenheit branch July 15, 2020 19:32
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* added conversions between celsius and fahrenheit

* Renamed celsius_to_fahrenheit.py

* Fixed spelling issues

* modified file to fit the 88-character limit

* added changes to pass the travis-ci test

* further changed the files to pass the travis-ci test

* further changed the files to pass the travis-ci test

* Shortened conversions/fahrenheit_to_celsius.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Type hints added to conversions/fahrenheit_to_celsius.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* changed the code to let the caller do the printing

* addressed the changes made on github

* Added Kelvin conversions and put temperature functions in a single file

* Removed whitespace from a blank line

* Update temperature_conversions.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants