我想從這個函數date2的追加到如何將變量從另一個功能python3追加
def date_register():
print("Enter date of registration")
year = int(input("Enter a year: "))
month = int(input("Enter a month: "))
day = int(input("Enter a day: "))
date1 = datetime.date(year,month,day)
date2 = date1 + timedelta(days = 140)
print("Check out date:",date2)
此功能,它出來date2的是沒有定義
def update_A(row): #to update the roomA
if len(roomA[row]) < 2: #if roomA is less than 2
name = input("Enter your name here: ")
print(date_register())
roomA[row].append((name,date2))
print("Your room no. is {} at row {}".format(roomA[row].index((name,date2))+1,row))
print(Continue())
尋求幫助,謝謝您
我的朋友,你忘記'返回'函數的結果'date_register'使它在'update_a'中可用。 –
你能否提供解決方案? – Jordan