Description
Describe the bugs
A) Final string should be reverted, with e.g. result = result[::-1], to yield the correct result.
python-tutorial/tutorial/tests/test_02_control_flow.py
Lines 412 to 419 in cbd5572
decimal //= to_base
#TODO: result = result[::-1] to revert the string
# Test: e.g. -"A00", from_base=16, to_base=13 (2560 in base_10) should return -121C and not -C121)
return f"-{result}" if is_negative else result
B) In the case of to_base=10 the sign is not added.
python-tutorial/tutorial/tests/test_02_control_flow.py
Lines 409 to 410 in cbd5572
if to_base == 10: return str(decimal) #TODO: Handle negative numbers e.g. f'-{str(decimal)}' if is_negative else str(decimal)
To Reproduce
Steps to reproduce the behavior:
A. reference_base_converter("-A00", 16, 13)
B. reference_base_converter("-A00", 16, 10) or any negative number converted from base!=10 to base=10
Expected behavior
A: reference_base_converter("-A00", 16, 13) returns -121C [2560 in base 10]
B: reference_base_converter("-A00", 16, 10) returns -2560
Where did you run the tutorial?
- Local installation (conda: jupyter lab)
Additional context
First GitHub reported issue, I apologize for anything unclear.