print "I can write my function to a txt file:"
my_function = raw_input("File name? ")
print_bills = input(bills(1010, 200, 100, 120))
open(my_function, 'w')
my_function.write('%r' % (print_bills))
my_function.close()
i'm working in python and am trying to get my function written to a txt file, the function goes like this
def bills(mortgage, elec, oil, ph_int_tv):
print "Our upcoming mortgage will be approximately %d /month)" % mortgage
print "Split between my brother and I, that will be %d /month" % (mortgage/2)
print "With a third roomate, it will be %d /month" % (mortgage/3)
print "My total bill, per month, with living costs included will be %d /month" % ((mortgage/2)+(elec/2)+(oil/2)+(ph_int_tv/2))
print "I better start saving money!!\n"
I'm pretty new, just started w/ the LPTHW online book... So my question is, what can i change in the top code to get this to work.... if anything?