Closed IltisGraph closed 1 year ago
I'm very happy to see you contributing to this library. The main objective of this library was to help the python beginners to see how importing and the code is being written inside a library works. Just using inbuilt functions and returning it as output does not fulfill the cause - [return hex(int(binary, 2))]. 😂😂😂 Anyway you should try to contribute to write a method on ur own and then raise a PR. You can also ask me if u are struck somewhere. Happy to help. Happy coding.
Hi! Actually I'm one of those beginners this repository aims for. So of course I remade the function and overall it was a very fun experience to understand how hex works. So thank for your advice!!!
you can rewrite the method without using in-built library methods so that I can merge it with the main branch.
@extinctsion I don't quite understand. I have rewritten the function already, what do I have to change? (Am I not allowed to use python functions like enumerate?)
@IltisGraph yes, the way you have written it now is good but the code is giving wrong output. Moreover you can test ur input and output in this website: Radpid Tables
@extinctsion I've hopefully fixed it now. I've tested it with a text function and there weren't any misstakes.
Still there is error with the output. Take reference from the sites given - [Binary to hexdec](https://codescracker.com/python/program/python-program-convert-binary-to-hexadecimal.htm#:~:text=Binary%20to%20Hexadecimal%20using%20int()%20and%20hex(),-This%20program%20uses&text=And%20using%20int()%20method,into%20its%20equivalent%20hexadecimal%20value.)
Plus it is giving error if we give 2 as input ([10 bin] -> 2)
@extinctsion I've hopefully fixed it now. I've tested it with a text function and there weren't any misstakes.
You should be writing a code that is readable, var names should be realted to what u are writing, and ur code should work for all test cases. All means all. For ex - If a user is giving a string as input then it should handle that error as well.
@extinctsion but why should we give 2 as an input, if there aren't such numbers in binary? Furthermore I checked the code and on my machine there is other output than in your screenshot...
@Jugalcody or @PreyumKr pls look into this issue and explain why the input is clashing with the code.
@IltisGraph im sorry to say but could you pls take this latest branch and rewrite the changes acc to py 3.x documentation and re raise PR? ill close this PR as everything is jumbled up here. Waiting to see ur new PR soon. ~ from easyPythonpi team
this function converts a binary string into hexadecimal as mentioned in the issue #20