amount_of_names = int(input("Input amount of players: "))
names = []
for counter in range(amount_of_names):
name = str(input("Input players first name: "))
names.append(name)
#print (names)
selected_name = str(input("Input your name: "))
while name in names:
import random
names = random.choice(names)
break
print (names)
我試圖用名稱與「你的名字」進行匹配,然後循環,直到名稱不匹配例如Bob:Sam(是)Sam:Sam(No) - 在此先感謝所有循環直到(py)
「循環期間清除」是什麼意思? –