How to save output of elif to a csv file in python?
<pre><code>import csv
with open("input.csv") as f:
    d1 = [row[0] for row in csv.reader(f)]
for x in d1:
    if 0&lt;=int(x)&lt;30:
        print("0&lt;=x&lt;30".format(x))
    elif 40&lt;=int(x)&lt;120:
        print("40&lt;=x&lt;120")
</code></pre>

<p>My code is shown above, and I am trying to save the output in a .csv file. Is there any solution to send data from <code>elif</code> to <code>csv.writer</code>?</p>