python noob need help

Soldato
Joined
30 Nov 2005
Posts
13,915
i am trying to practice some code i want to loop round getting the user to enter a number of values depending on a specified number



ref = raw_input('please enter reference number : ')
tint = raw_input('enter the number of items: ')
i = 0
basic =[]
amount =[]
while i < tint :
basic[i:] = raw_input('enter basic : ')
amount[i:] = raw_input('enter amnount :')
i = i +1
am i on the right track with the lists?

i need to read input in to the list but list only needs to be as big as number of items
 
Last edited:
sussed it

ref = raw_input('please enter reference number : ')
tint = input('enter the number of items: ')
i = 1
items = []
amounts = []
while i <= tint :
print 'Enter item: ' ,
item = [raw_input()]
i = i +1
items.append(tinter)
print 'Enter amount: ',
value = [raw_input()]
amounts.append(value)
 
Back
Top Bottom