-1
import random
import time
greetingsKeyword = ["hello", "hi", "whatsup", "sup"]
geetingresponse = ["hi", "hello", "how you doing?"]
keywordd = random.choice(greetingsKeyword)
resposne = random.choice(geetingresponse)
user_input = input()
if (user_input == greetingsKeyword):
print (resposne)
else:
print ("bye")
time.sleep(5)
我不能修復它,我試圖找到在互聯網的答案,但沒有什麼:(打印隨機字符串與如果else語句
你需要說出問題所在。這非常含糊。你有錯誤嗎?輸出錯誤? – Carcigenicate
你也不會注意到你的特定版本的Python。 – jpmc26
[input()error - NameError:name'...'未定義]的可能重複(https://stackoverflow.com/questions/21122540/input-error-nameerror-name-is-not-defined)if這實際上是Python 2.OP對我現在刪除的答案評論了一個錯誤的圖片。 – Carcigenicate