代码

newbase = int(input('Enter the new base:'))
decimalnumber = int(input('Enter the new number to be converted:'))
quotient=1
answer=''
dict1={'10':'A','11':'B','12':'C','13'😂','14':'E','15':'F'}
while quotient != 0:
quotient = decimalnumber // newbase
reminder = str(decimalnumber % newbase)
if reminder in dict1:
reminder = dict1[reminder]
answer = reminder + answer
decimalnumber = quotient
print('The anwser is '+ answer)

运行截图