[Tutor] Problems ugh help please

Amanda Colley acolle00 at g.uafortsmith.edu
Sat Oct 13 22:17:21 CEST 2012


I am trying to add the total pounds that will be shipped. I keep getting an
error of unknown format code 'f' for object of type 'str' when I try to
float the pounds. and when I dont float it it gives me a total weight of
<function pounds at 0x00000000032B92CB> when it exicutes.  here is the code
I have.

def pounds():
    h_book=weight('Hardback',2.1)
    p_book=weight('Paperback',1.3)
    print('Your total weight of book(s) at',pounds)
    return pounds
def weight(desc,weight):
    print('How many',desc,'books do you want at',weight,'pounds do you
want?')
    num=int(input())
    pounds=float(num*weight)

-- 
Amanda Colley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121013/b2a13c81/attachment.html>


More information about the Tutor mailing list