私が番号を入力するようユーザーに求めています..Pythonのリスト/インデックスクエリ
これは私が現在持っているコードです。
List = ["a", "b", "c", "d", "e", "f"]
print "The list has the following", len(List), "list:", List
new_item = raw_input("Which item would you like to add? ")
List.append(new_item)
print "The list has the following", len(List), "items:", List
Number = raw_input ("Please select a number: ")
あなたの質問がありますか? –
'print List [Number]'? –
ユーザーに番号を入力するように依頼することによって....そのインデックスの項目を表示することができます。ユーザーが2を入力した場合、私は "c"を表示したいと思っています。iveはもっとコードを悩ましていますが、それを動かすことはできません。 – IrishGal