-4
我會得到一個編號爲這段代碼的輸出:倒車功能在蟒蛇的輸出是不是列表
base = int(raw_input("Pick your base: "))
base = str(base)
question = "Pick your number! (the base is "+base+"): "
number = int(raw_input(question))
def func(number):
if number != 0:
sec = number/int(base)
third = number - (sec * int(base))
print third,
func(sec)
func(number)
我想借此輸出(例如2435)和反向它(到5342)。我已經通過分配func(number)
給一個變量,然後打印該variable[::-1]
嘗試a[::-1]
然而,這似乎並沒有工作:
x = func(number)
print x[::-1]
這給了我:
TypeError: 'NoneType' object has no attribute 'getitem'
'func'返回什麼值? :) – Caramiriel
這取決於用戶輸入 –
否 - 在語言定義中查找「函數」。 *你的*'func'返回什麼? – jcoppens