- Python 3.7 or above
- No modules are required.
Binary Translator ia a simple Python repository that translates numbers into binary. This program is copyright (C) 2021 Peter Nielsen. See LICENSE.md for more details.
-
Navigate to the folder in Git Bash.
cd C:/example/path/to/binarytranslate
. -
Run the main file using the command:
python main.py
. Python must be installed on your system for this operation to complete. -
When prompted, enter an integer up to
65535
. -
Output in binary is given.
- Navigate to the folder in Terminal:
cd ~/example/path/to/binarytranslate
- Run the main file using this command:
python3 main.py
. Python must be installed on your system for this operation to complete. - When prompted, enter an integer up to
65535
. - Output in binary is given.
-
Navigate to the folder in Windows Explorer or Finder (MacOS).
-
Double-click on the file and it will open a Python shell. Python must be installed on your system for this operation to complete.
-
When prompted, enter an integer up to
65535
. -
Output in binary is given.
The program takes input from the user using Python's out-of-the-box input() function. This input is saved as a variable, user_input
. Then, for every binary place in a large range, that amount is subtracted if the number is great enough to meet a binary value. During each calculation, the program determines whether to set that place's digit to 1
or 0
. The digits are combined and then printed to the console using an f string. If an option that is higher than 65535
is given, it returns an error message; another error will be returned if the input is not an integer (using a try/except statement).
I create programs in a variety of languages, from Python to JavaScript to CSS and more. I'm on GitHub: @peternielsen112 and also Replit.com by the same username. Please email any problems or suggestions to me at [email protected].