This is my code its to calculate book club points earned. i cant see where the error is if any one can help me i would be very gratefull. thank you

def main():
books = getBooks
points = getPoints
printPoints

def getBooks():
books = input("enter the books purchased")
return books

def getPoints(books):
if books <= 0:
points = 0
elif books <= 1:
points = 5
elif books <= 2:
points = 15
elif books <= 3:
points = 30
elif books <= 4:
points =60
return points

def printPoints(books,points):
print ("you bought ,books, you now have ,points,")


main()

Re: I need help please 80 80

Use code tags to preserve pythonic look and catalyse rate of answering your question

Re: I need help please 80 80
def main():
    books = getBooks
    points = getPoints
    printPoints

def getBooks():
    books = input("enter the books purchased")
    return books

def getPoints(books):
    if books <= 0:
        points = 0
    elif books <= 1:
        points = 5
    elif books <= 2:
        points = 15
    elif books <= 3:
        points = 30
    elif books <= 4:
        points =60
    return points

def printPoints(books,points):
    print ("you bought ,books, you now have ,points,")


main()
Re: I need help please 80 80

script
[def main():
books = getBooks
points = getPoints
printPoints

def getBooks():
books = input("enter the books purchased")
return books

def getPoints(books):
if books <= 0:
points = 0
elif books <= 1:
points = 5
elif books <= 2:
points = 15
elif books <= 3:
points = 30
elif books <= 4:
points =60
return points

def printPoints(books,points):
print ("you bought ,books, you now have ,points,")


main()]

Re: I need help please 80 80

you cant edit your post or i just cant find it

Re: I need help please 80 80

Write "CODE=python" enclosed in square brackets then paste your code from your editor and end it with "/CODE" also in square brackets.
Note, all are without Quotes

Re: I need help please 80 80

Here we go:

def main():
    books = getBooks
    points = getPoints
    printPoints

def getBooks():
    books = input("enter the books purchased")
    return books

def getPoints(books):
    if books <= 0:
        points = 0
    elif books <= 1:
        points = 5
    elif books <= 2:
        points = 15
    elif books <= 3:
        points = 30
    elif books <= 4:
        points =60
    return points

def printPoints(books,points):
    print ("you bought ,books, you now have ,points,")


main()
Re: I need help please 80 80

Okay here is a version with a lot of things fixed:

def main():
    books = getBooks()  #Remember those () otherwise the functions are not called
    points = getPoints(books) #again
    printPoints(books, points)

def getBooks():
    books = input("enter the books purchased")
    return books

def getPoints(books):
    if books <= 0:
        points = 0
    elif books <= 1:
        points = 5
    elif books <= 2:
        points = 15
    elif books <= 3:
        points = 30
    elif books <= 4:
        points =60
    return points

def printPoints(books,points):
    print ("you bought" ,books, "you now have ",points) #Remeber to split up the string


main()
Re: I need help please 80 80

thanks for your help paul

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.