Commit Graph

44 Commits

Author SHA1 Message Date
Sabari Ganesh
582f57f41f
Added physical pressure units (#5613)
* Added physical pressure units

This uses tuple pair which stores units required to be converted to respective other units as mentioned.
Available Units:- Pascal,Bar,Kilopascal,Megapascal,psi(pound per square inch),inHg(in mercury column),torr,atm

* Formatted file

File was formatted as per repo rules

* Reformatted file :)

* Added more reference

* More reference added
2021-10-26 19:55:41 +02:00
Sabari Ganesh
23f43afee5
Added volume conversions (#5607)
* Added volume conversions

This is a file which has relevant function which helps in conversion between volume units.
Available Units:- Cubic metre,Litre,KiloLitre,Gallon,Cubic yard,Cubic foot,cup

The file is also written in a way that , adding a new unit can easily be done by modifying tuple available in the source code

* Formatted file

The file was formatted to follow the syntax formatting rules of the repo

* Formatted file further
2021-10-26 17:57:59 +02:00
Francisco Perez
568c107e68
add bin_to_hexadecimal (#5156) 2021-10-25 15:58:24 +08:00
Christian Clauss
f7804334f1
length_conversion.py: Deal with uppercase and abbreviations (#5433)
* length_conversion.py: Deal with uppercase and abbreviations

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-19 11:11:49 +02:00
Christian Clauss
aa0ace4df7
Remove exception detail from doctest (#5430)
* Remove exception detail from doctest

These details are configuration dependant so should be removed according to https://docs.python.org/3/library/doctest.html

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-19 08:05:20 +02:00
Sabari Ganesh
66c96aa037
Added length unit conversions (#5373)
* Added length unit conversions

Conversion of length units were added with respective tests being implemented and passed.
Available Units:- Metre,Kilometre,Feet,Inch,Centimeter,Yard,Foot,Mile,Millimeter

* Formatted File

File was formatted to go as per repo rules

* Reformatted file

* Reformatted code once again

* Added more test 

Added test to evaluate whether the code handles wrong arguements passed

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Update length_conversions.py

* Fixed  Minor errors in test

One of the test was failing and it was fixed

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-19 07:26:03 +02:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
TANMAY SRIVASTAVA
368ce7aecc
Added a hex-bin.py file in conversion.py (#4433)
* Added a file that converts hexa to binary

* Added file to convert hexadecimal to binary

* Update hex-bin.py

* added type hint in the code

* Added doctest

* Added code to handle exception

* Resolved doctest issue

* Update hex-bin.py

* Modified convert function

* Added WhiteSpace around operators.

* Made more pythonic

* removed whitespace

* Updated doctest command

* Removed whitespace

* imported union

* Replaced flag with is_negative

* updated return type

* removed pip command

* Resolved doctest issue

* Resolved doctest error

* Reformated the code

* Changes function name

* Changed exception handling statements

* Update and rename hex-bin.py to hex_to_bin.py

* Update newton_method.py

* Update matrix_operation.py

* Update can_string_be_rearranged_as_palindrome.py

* Update hex_to_bin.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-05-20 10:28:00 +02:00
algobytewise
1a39970538
Add rgb_hsv_conversion.py (#4334)
* Add rgb_hsv_conversion.py

* updating DIRECTORY.md

* snake-case

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-04-23 08:24:01 +02:00
Dhruv Manilawala
20c7518028
fix(mypy): type annotations for conversions algorithms (#4314)
* fix(mypy): type annotations for conversions algorithms

* refactor(CI): include conversions algorithms for mypy tests
2021-04-04 15:25:49 +02:00
Kavindu Santhusa
03889613bc
add integer to roman function (#4050)
* add integer to roman function

simply added fastest method i found.

* Rename roman_to_integer.py to roman_numerals.py

* Update roman_numerals.py

* Update roman_numerals.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-12-21 22:55:59 +01:00
Anubhav Solanki
9333d2f017
Create weight_conversion.py (#3964)
* Create weight_conversion.py
* Update weight_conversion.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-27 21:33:17 +05:30
Mikail Farid
49d0c41905
Renamed octal_to_decimal to octal_to_decimal.py (#3420)
* Renamed octal_to_decimal to octal_to_decimal.py
* Updated octal_to_decimal.py
* modified doctests
* updated octal_to_decimal.py
2020-11-23 11:41:28 +05:30
Prakhar Gurunani
a6ad25c351
Add molecular_chemistry.py (#2944)
* Create molecular_chemistry.py

* round up outputs

* Remove floating point

* Add Wikipedia references

* fixup! Format Python code with psf/black push

* Add Conversions/Molecular Chemistry

* updating DIRECTORY.md

* Update molecular_chemistry.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-10 08:20:27 +01:00
Mikail Farid
5fcd250c99
Added decimal_to_binary_recursion.py (#3266)
* Added decimal_to_binary_recursion.py

* Added decimal_to_binary_recursion.py

* Made changes to docstring

* Use divmod()

* binary_recursive(div) + str(mod)

* Be kind with user input if possible

* Update decimal_to_binary_recursion.py

* ValueError: invalid literal for int() with base 10: 'number'

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-14 12:27:08 +02:00
Sabari Ganesh
e9865ae611
Update temperature_conversions.py (#2522)
* Update temperature_conversions.py

Added Reaumur scale unit conversions.

* Update temperature_conversions.py

* Update temperature_conversions.py
2020-10-03 22:02:58 +05:30
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Christian Clauss
b05081a717
Update and rename bin_to_octal.py to binary_to_octal.py (#2449)
* Update and rename bin_to_octal.py to binary_to_octal.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 14:58:08 +08:00
mohammadreza490
b22596cd96
bin_to_octal (#2431)
* bin_to_octal

Converts binary values to the octal equivalent.

* Update bin_to_octal

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Update conversions/bin_to_octal

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Rename bin_to_octal to bin_to_octal.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-09-19 13:36:56 +08:00
Du Yuanchao
d6bff5c133
Renamed files and fixed Doctest (#2421)
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-13 13:27:20 +02:00
mohammadreza490
1b3fec3f1f
binary_to_decimal converter (#2400)
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 06:16:43 +02:00
mohammadreza490
696cd47e15
octal_to_decimal converter (#2399)
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-10 10:37:29 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
mohammadreza490
1385e47c36
Create hexadecimal_to_decimal (#2393)
* Create hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

Added negative hexadecimal conversion to decimal number

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-04 15:48:44 +02:00
lance-pyles
f760ecc73c
initial commit of prefix-conversions (#2243)
* initial commit of prefix-conversions

* minor tweaks;

* Lose the blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 00:11:16 +02:00
lance-pyles
44f9fd12c2
added tests (#2234) 2020-07-25 20:58:53 +02:00
lance-pyles
99b40e2a26
add Rankine scale (#2232)
* add Rankine scale
black formatting

* add Wikipedia links

* add optional rounding, default to 2 digits

* fix variable name

* fixed variable name; helps to stage before commiting
2020-07-24 22:55:18 +02:00
karimzakir02
88e82db89a
Celsius to Fahrenheit Conversions (#2188)
* 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>
2020-07-15 21:30:54 +02:00
Hardik Aggarwal
b6ca263983
Update decimal_to_binary.py (#2185)
"an Integer" instead of "a Integer"
2020-07-07 13:26:10 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Christian Clauss
ae9d0f9196
Fix indentation (#2097) 2020-06-14 14:28:00 +08:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
bnMikheili
ec2d900b03
implement sdbm hash algorithm (#2094)
* implement sdbm hash algorithm

* fix bug: styling

* fix styling for decimal_to_any
2020-06-11 22:22:16 +02:00
Kevin C. Escobedo
19c3871b21
Added function to convert from decimal to another base (#2087)
* Added function to convert from decimal to another base

* Update conversions/decimal_to_any.py

Changed type() to isinstance()

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

* Update conversions/decimal_to_any.py

Changed to base in (0, 1)

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

* Update conversions/decimal_to_any.py

Updated to div not in (0, 1)

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

* Update conversions/decimal_to_any.py

Updated to make condition clearer

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

* Update conversions/decimal_to_any.py

Using divmod() instead of % operator

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

* Update conversions/decimal_to_any.py

Improved readability on a docstring test

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

* Update conversions/decimal_to_any.py

Changed use of type() to isinstance()

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

* Update conversions/decimal_to_any.py

Changed from use of type() to isinstance()

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

* Made changes and improved function

* Update conversions/decimal_to_any.py

Added space to docstring test

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

* Changed action for bad input

* Added support for conversions up to base 36 (#2087)

* Added support for conversions up to base 36 and renamed HEXADECIMAL dict (#2087)

* Fixed whitespace issue (#2087)

* Fixed issue with line length (#2087)

* Fixed issue with conversions past base-10 failing (#2087)

* Added more robust testing (#2087)

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 17:59:42 +02:00
Shivam Verma
d7cc778092
conversions/decimal_to_binary.py: Add type hints (#2001)
* A .py file to covert a base to any new base(2-18)

* Update base_changer.py

* Added type-hints.

* Delete base_changer.py
2020-06-02 16:47:10 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Jasper
3242682473 Create roman_to_integer.py (#1636)
* added roman to integer conversion (LeetCode No. 13)

* updated directory to include Roman to Integer

* Delete DIRECTORY.md

* Update roman_to_integer.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2019-12-21 00:23:15 +01:00
Jawpral
74d96ab355 Fixed issue #1368 (#1482)
* Changed as suggested

Now return in same format as oct() returns

* Slight change

* Fixed issue #1368, return values for large number now is fixed and does not return in scientific notation

* Update decimal_to_octal.py
2019-12-08 23:27:42 +01:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Syed Waleed Hyder
e313141904 bin(num). convert ZERO and negative decimal numbers to binary. (#1093)
* bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* Added doctests. bin(num) can convert ZERO and negative decimal numbers to binary. Consistent with built-in python bin(x) function.

* doctests still failing.

* Doctests added.
2019-08-03 20:00:10 +02:00
Jasper
3b63857b65 added automated doctest to decimal_to_hexadecimal.py in conversions (#1071)
* added automated doctest to decimal_to_hexadecimal.py in conversions

* improved error handling and added more test cases in decimal_to_hexadecimal.py

* implemented 0x notation and simplified AssertionError

* fixed negative notation and added comparison test against Python hex function
2019-07-26 18:28:32 +02:00
Jasper
8b2d1b7f50 added decimal to hexadecimal conversion (#977)
* added decimal to hexadecimal conversion

* fixed error occuring as more digits were needed
2019-07-09 09:03:18 +02:00
PatOnTheBack
1c9d995b9e Implement Three New Algorithms (#948)
* Create average_median.py

I created a program to calculate the median of a list of numbers.

* Changed Odd to Even in String

* Create decimal_to_binary.py

- Added 'conversions' folder.
- Created a decimal to binary converter.

* Implemented Decimal to Octal Algorithm

- I created a decimal to octal converter based on the converter in the TheAlgorithms/Python project.
- I added two newlines to make the output of decimal_to_binary.py better.
2019-07-05 14:06:48 +05:30