Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

print statement question

$
0
0
Hi folks,

I am pretty new to Python and have a general question regarding altering the content/style of print statements. I am wondering how I could alter the last print statement in the code below, in two ways. I would like to print "This zone is of top priority" (or, high, some, or low). So, I would like to extract only the first word (i.e., TOP, HIGH, SOME, LOW), convert it to lowercase, and put it back in the print statement (without CONCERN) for each row in the loop. My first thought was to put individual print statements directly in the if/elif/else, but I'm wondering if there is a way to do one statement for all results. Thanks in advance!

Code:

        for row in rows:
            if result2 >= 15:
                row.PRIORITY = "TOP CONCERN"
            elif result2 < 15 and result2 >= 12:
                row.PRIORITY = "HIGH CONCERN"
            elif result2 < 12 and result2 >= 6:
                row.PRIORITY = "SOME CONCERN"
            else:
                row.PRIORITY = "LOW CONCERN"
            row.INCIDENTS = result
            rows.updateRow(row)
            print "The number of graffiti incidents in the " + patrolZoneID +  " patrol zone is " + str(result) + " and the number of incidents per acres is " + str(result2)
            print "This zone is of " + row.PRIORITY


Viewing all articles
Browse latest Browse all 2485

Trending Articles