所以我有下面的代碼,出於某種原因,兩個變量「大」和「小」似乎並沒有加起來,我不知道爲什麼。請幫幫我。考慮python變量的總和
n = int(input("number:"))
x = map(int, str(n))
x = [int(x) for x in tal]
x.sort(reverse=True)
large = "".join(map(str, x))
x.sort()
small = "".join(map(str, x))
int(large)
int(small)
large + small=y
print(y)
我認爲應該是'y = large + small'?什麼是'tal',爲什麼你使用'int(str(int(n)))' – Chaker
你得到的錯誤在你的程序中有很多錯誤 – The6thSense
你在列表理解中使用的變量'tal'是什麼? –