lundi 27 septembre 2021

Skipping elif statements

My code is skipping the 3rd and 4th elif statement. Instead of plotting red or purple dots for values that fall between 86 and 106 and then values between 106 and 201, they are plotting maroon which is the else statement. Why is my code skipping over those two conditions? It reads the first two elif statements as I wish so I do no understand what is happening with the last two.

if zlist < '55':
    plt.scatter(x = xlist, y = ylist, color = 'green')
    plt.xticks(rotation=90)
    plt.text(xlist, ylist, zlist)
    
elif '55' < zlist < '71':
    plt.scatter(x =xlist, y =ylist, color = 'yellow')
    plt.xticks(rotation = 90)
    plt.text(xlist, ylist, zlist)
    
elif '71' < zlist < '86':
    plt.scatter(x =xlist, y =ylist, color = 'orange')
    plt.xticks(rotation = 90)
    plt.text(xlist, ylist, zlist)
             
elif '86' < zlist < '106':
    plt.scatter(x =xlist, y =ylist, color = 'red')
    plt.xticks(rotation = 90)
    plt.text(xlist, ylist, zlist)
             
elif '106' < zlist < '201':
    plt.scatter(x =xlist, y =ylist, color = 'purple')
    plt.xticks(rotation = 90)
    plt.text(xlist, ylist, zlist)
             
elif zlist > '201':
    plt.scatter(x =xlist, y =ylist, color = 'maroon')
    plt.xticks(rotation = 90)
    plt.text(xlist, ylist, zlist)
    

Aucun commentaire:

Enregistrer un commentaire