0
I need help with a code to convert any base number into a decimal number, where user input is involved?
number systems
3 Antworten
+ 1
please link your code here using the code play ground so that other users can help you out
+ 1
let me give you a trick i learned to change different base numbers and turn it into decimal (base 10).
int(value, baseOfValue)
changing binary into decimal
base 2 into base 10
num = "1100"
print(int(num, 2))
>>>
12
changing hexadecimal into decimal.
base 16 into base 10
num = "c6"
print(int(num, 16))
>>>
198
0
bin -> int
hex -> int
oct -> int
int(input())