Commit Graph

37 Commits

Author SHA1 Message Date
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