私は私の配列の宿題に問題が生じています、私は名前を入力する必要があり、プログラムは数を返すために持っているが、私はそれが何を得ることができるすべては、それらのすべて電話番号検索プログラム
def main():
people = ['todd','david','angela','steve','bob','josh','ben']
phoneNumbers = ['234-7654','567-1234','888-8745','789-5489','009-7566','444-6990','911-9111']
found = False
index = 0
searchValue = raw_input('Enter a name to search for phone number: ')
while found == False and index < len(people):
if people[index] == searchValue:
found = True
else:
index = index + 1
if found:
print 'the phone number is: ',phoneNumbers
else:
print 'that name was not found'
main()
を返すです
配列を使用する必要がありますか?辞書はここでより良いデータ型です... – tobyodavies