Adding up a list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fullmoon84
    New Member
    • Sep 2006
    • 9

    #1

    Adding up a list

    if we allow user to key in all the datas that they have, and we will help them sum up all, how to do?? below are program i do but it did.t work.

    run=0
    while run<>999:

    #insert number of datas you have
    n=raw_input("in sert n:")
    n=int(n)
    x=int(n)

    for x in range (1,n+1):
    if x == n+2:
    break

    print"insert value of a:\n"

    a=raw_input("in sert a:\t")
    a=float(a)

    # X= total value of a
    print"\nX=total value of a"
    def add(x) : return a+a
    x=int(a+a)
    print"X=%d+%d+% d=" % (a,a),a+a


    can anyone help me?? thank you
Working...