CS计算机代考程序代写 python # Documentation for “adder” function:

# Documentation for “adder” function:
#
# models an n-bit ripple-carry adder in python
# takes positive integer n >=1, and two collections of bits of length >= n
# forms the n-bit sum of adding the lowest n bits of the two bit strings together,
# each interpreted as unsigned integers
# if the sum cannot be represented in n bits, it will overflow modulo 2^n
#
# returns a three-tuple of hexadecimal values:
# carryOut — the carry out from the addition
# sumOut — the n-bit sum modulo 2^n
# allCarries — the value of every carry in the ripple carry adder, as
# a set of bits, including the final carry out.
#
# example: for n=2, bitStringA=0x101 and bitString_B = 0xFF
# the lowest two bits of each string would be 01 and 11
# adding these together would produce 00 with a carry out of 1,
# having formed carries of 11 in a ripple carry adder
def adder(n, bitString_A, bitString_B):
carryOut=”FIXME”
sumOut = “FIXME”
allCarries = “FIXME”
return (carryOut, sumOut, allCarries)