About 51 results
Open links in new tab
  1. Convert integer to binary using 2 functions - Python

    Jun 22, 2022 · The program must define and call the following two functions. Define a function named int_to_reverse_binary() that takes an integer as a parameter and returns a string of 1's …

  2. python - Convert an integer to binary without using the built-in …

    Nov 23, 2012 · This function receives as a parameter an integer and should return a list representing the same value expressed in binary as a list of bits, where the first element in the …

  3. Using Python to convert integer to binary - Stack Overflow

    Jan 30, 2013 · here is a code that works in python 3.3.0 the converts binary to integer and integer to binary, JUST COPY AND PASTE!!!

  4. How do you express binary literals in Python? - Stack Overflow

    Python 2.5 and earlier: can express binary using int('01010101111',2) but not with a literal. Python 2.5 and earlier: there is no way to express binary literals. Python 2.6 beta: You can do like so: …

  5. Need help in adding binary numbers in python - Stack Overflow

    Not an optimal solution but a working one without use of any inbuilt functions. # two approaches # first - binary to decimal conversion, add and then decimal to binary conversion # second - …

  6. Binary search (bisection) in Python - Stack Overflow

    Oct 17, 2008 · Many good solutions above but I haven't seen a simple (KISS keep it simple (cause I'm) stupid use of the Python built in/generic bisect function to do a binary search. With …

  7. Converting integer to binary in Python - Stack Overflow

    The Python package Binary Fractions has a full implementation of binaries as well as binary fractions. You can do your operation as follows: from binary_fractions import Binary b = …

  8. Convert decimal to binary in python - Stack Overflow

    Aug 20, 2010 · For the sake of completion: if you want to convert fixed point representation to its binary equivalent you can perform the following operations: Get the integer and fractional part. …

  9. bit manipulation - Two's Complement in Python - Stack Overflow

    Oct 22, 2009 · Constraint: should approaches assume the string only contains '1's (and maybe 0's'), no spacing characters like commas, apostrophes, spaces or underscores (which are very …

  10. binary search - What are python's equivalents of std::lower_bound …

    Jun 17, 2016 · Those functions are located in the bisect module: bisect.bisect_left(a, x, lo=0, hi=len(a)) is the analog of std::lower_bound(). bisect.bisect_right(a, x, lo=0, hi=len(a)) is the …

Refresh