lundi 26 novembre 2018

if statement and for loop

This is the piece i'm trying to run. It has worked and then it started messing up. Basically it is meant to iterate through a for loop and if inptype != sale then it is meant to skip the iteration of the loop and continue with the next one. However, when the value does not the statement it should skip to the else statement and continue, but it doesn't and it follows the procedure for inptype != sale even when the value does equal sale.

Here is my code

for row in reader:
    inpname = str(row[15])
    inptype = str(row[19])
    print(inptype)
    print (inpname)
    if not row: # if row is blank
    print("not row")
   continue# continue loop on next iteration of for loop
   elif "CUSTOMER DISCOUNT" in inpname:
                    print("customer dis")
                    continue
                elif inptype != "Sale" or "sale" or "SALE":
                    continue
                else:

All the indentation levels are correct on the IDLE, but stackover flow didn't format it correctly

Aucun commentaire:

Enregistrer un commentaire