Today we friends have faced trouble when making tally of the amount we have paid for the new flat advance, the amount company provided, the money given to broker.
So planned to make a budget calculator
names=[]
def fun(numbers):
while True:
x=raw_input("if done enter stop: ")
numbers.append(x)
if x == 'stop':
break
return numbers
def func_sum(a,b,c):
for i in range(0,b):
x=a[i]
print "Enter the calculation of %s" % x
y=eval(raw_input("Enter "))
z = c - float(y)
print "The amount to be paid by /should be paid to if negative.... %s is %r" % (x,z)
print "\n \n"
print "Enter the name"
fun(names)
lenames= len(names) - 1
totalamount=int(raw_input("Enter the total amount "))
payofone = totalamount / lenames
print "\n \n One should pay %d \n" % payofone
func_sum(names,lenames,payofone)
=======================
rahul@rahul-Inspiron-3542:~$ python budget.py
Enter the name
if done enter stop: vishnu
if done enter stop: namshir
if done enter stop: appukuttan
if done enter stop: rahul
if done enter stop: stop
Enter the total amount 6890
One should pay 1722
Enter the calculation of vishnu
Enter 100
The amount to be paid by /should be paid to if negative.... vishnu is 1622.0
So planned to make a budget calculator
names=[]
def fun(numbers):
while True:
x=raw_input("if done enter stop: ")
numbers.append(x)
if x == 'stop':
break
return numbers
def func_sum(a,b,c):
for i in range(0,b):
x=a[i]
print "Enter the calculation of %s" % x
y=eval(raw_input("Enter "))
z = c - float(y)
print "The amount to be paid by /should be paid to if negative.... %s is %r" % (x,z)
print "\n \n"
print "Enter the name"
fun(names)
lenames= len(names) - 1
totalamount=int(raw_input("Enter the total amount "))
payofone = totalamount / lenames
print "\n \n One should pay %d \n" % payofone
func_sum(names,lenames,payofone)
=======================
rahul@rahul-Inspiron-3542:~$ python budget.py
Enter the name
if done enter stop: vishnu
if done enter stop: namshir
if done enter stop: appukuttan
if done enter stop: rahul
if done enter stop: stop
Enter the total amount 6890
One should pay 1722
Enter the calculation of vishnu
Enter 100
The amount to be paid by /should be paid to if negative.... vishnu is 1622.0
Comments
Post a Comment