Heading Here #Hello
I am reading a book that doesn't do a very good job of explaining things. It is talking about parallel arrays and gives an example of pseudo-code. I am trying to figure out how to access the parallel arrays using python and I wrote this little tidbit to try to better understand but I can't figure out how to associate the user input with the proper discount. Please help. all I'm getting is a 0 discount printed back.Thank you in advance
quantity=0
SIZE = 4
DISCOUNT=[0,0.10,0.15,0.20]
QUAN_LIMIT= [0,9,13,26]
X=0
input("Enter quantity ordered")
x = SIZE-1
while quantity < QUAN_LIMIT[x]:
    x=x-1
    print 'your discount rate is',DISCOUNT[x]

Use
quantity = input()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.