Can someone solve this practice exam question, python 3
def bin2dec(s): product = 1 decimal = 0 for x in s[::-1]: if (x=='1'): decimal += product product = product * 2 return decimal # Testing print(bin2dec('110')) print(bin2dec('11111111')) print(bin2dec('1'))
Can someone solve this practice exam question, python 3 5. (+15) Write a function bin 2dec...
please answer in python print Cannot divide anything but numbers. else - print n. 5. (+15) Write a function bin2dec( ) that takes a string representation of any length binary number and returns the decimal equivalent without using any type_conversions. Remember that the binary representation of a number has a power of 2 in each position, starting with 2° in the right most position and increasing by 1 as it moves left (e.g. 242'2') 6 >>> binadec('110') 2721862.1 >>> bin2ded('11111111)...
can someone please help me write a python code for this urgently, asap Question: Write a Python function, minmp, that is passed a file name and a metal alloy's formula unit structure*". The file will contain metal elements and their properties. The function will return a tuple of the element from the formula with the lowest melting point and that melting point Write a second function, molform, that will be called by the first function, to take the metal alloy's...
can someone write me a wing101 python code for this please Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance travelled (also called the range) is given by where the altitude of the landing position is Δh higher than that of the launch position and g is the gravitational acceleration (use 9.81 m/s^2). Note: θ in theformula is in radians write a Python function that accepts ν, θ and...