python 3.x - Convert to decimal arguments -
two integers command line arguments first expressed base of second. how this
enter code here import sys = int(sys.argv[1]) b = int(sys.argv[2])
do use binary search? there question on here convert decimal how take arguments base second eg 110 2 6
use conversion:
a = sys.argv[1] b = sys.argv[2] number = int(a, base=int(b))
as specified in documentation:
return integer object constructed number or string x, or return 0 if no arguments given. if x number, return x.int(). floating point numbers, truncates towards zero. if x not number or if base given, x must string, bytes, or bytearray instance representing integer literal in radix base.
Comments
Post a Comment