我想創建一個程序並獲取用戶數據,然後將其傳遞給另一個函數,但我不斷收到一個NameError,即使我(似乎)正確傳遞參數並調用該函數參數。傳遞參數錯誤
這裏是我的代碼示例:
#Define prompt to get player name
def welcomePrompt():
print("Welcome to my beachy adventure game!")
name=(input("Before we start, you must check-in, what is your name?:"))
return name
#Define dictionary to access all player data
def dataDict(name):
name=name
print(name)
def main():
welcomePrompt()
dataDict(name)
main()
可能有人請幫忙嗎?謝謝
你忘了'打印關閉字符串',添加報價 –