Files
mathgenerator/mathgenerator/funcs/computer_science/binary_to_hex.py
Luke Weiler 4f21bbd3ab Use latex as default output (#402)
* Improve combine_like_terms

* Lint fix

* add some latex to readme

* give compound_interest latex formatting

* fix compound interest readme

* update combine_like_terms readme

* combine_like_terms add delimiters

* Convert some alebra output to latex

* Add missing right] to latex

* Fix makeReadme script

* Correct det 2x2 latex

* use bmatrix for det 2x2

* update readme and bump version

* Make latex matrix one line

* made latex for most of algebra

* more latex migrations

* convert basic_math to latex

* re-generate readme

* fix double exponent

* latex for most of calculus

* Improved stationary points gen

* made cs latex

* Transform geometry to latex

* texify misc outputs

* texify statistics

* regenerate readme

* Add tex markers to linear_equations

* add list_to_tex for mult_int_22

* upgrade readme

* update list_to_tex

* add end to list_to_tex

* tweak list_to_tex, update readme

* Update README.md

* Update README.md

* lint fixes

* lint fix

* Remove tests

* texify system_of_equations

* update system_of_equations tex

* regen readme

* texify complex_quadratic

* update complex_quadratic

* regen readme

* sqrt to complex_quadratic

* complex_quadratic texify

* Update README.md

* Update README.md

* make latexbuilder

* regen readme

* fix bmatrix

* bmatrix conversions

* update readme

* use times symbol

* improve tex of prod_sci_notations

* Add missing delim to prod of sci notations

* Add missing curly brack to prod-sci-not

* lint fixes

* texify differentiation

* texify stationary points

* changed differentation to trig_differentiation

* texify stationary points

* update readme

* Remove left right from stat_points

* texify angle_btw_vectors

* update readme

* add spaces to mod operator

* Swap \\% with \\percent

* update readme

* Replace //percent with non-math %

* fix leftover \\percent

* latexify vector_cross

* change tex multiply to times

* update readme

* lint fixes

* lint fix
2022-12-23 00:38:59 -05:00

17 lines
396 B
Python

from ...generator import Generator
import random
def gen_func(max_dig=10):
problem = ''
for _ in range(random.randint(1, max_dig)):
temp = str(random.randint(0, 1))
problem += temp
solution = f'${hex(int(problem, 2))}$'
return f'${problem}$', solution
binary_to_hex = Generator("Binary to Hexidecimal", 64, gen_func,
["max_dig=10"])