Announcement

Collapse
No announcement yet.

Python: Book Club Points Problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python: Book Club Points Problem

    Instructions:

    Write a program that awards book club points to its customers based on the number of books purchased each month. The points are awarded as follows:
    • If a customer purchases 0 books, he or she earns 0 points.
    • If a customer purchases 1 book, he or she earns 5 points.
    • If a customer purchases 2 books, he or she earns 15 points.
    • If a customer purchases 3 books, he or she earns 30 points.
    • If a customer purchases 4 books, he or she earns 60 points.
    • If a customer purchases 5 or more books, he or she earns 100 points.



    Define a function called main that asks the user to enter the number books that he or she has purchased this month. This function should call the showPoints function to process the number of books purchased.
    Define a function called showPoints. This function should be passed the number of books purchased by the customer (information obtained in the main function) and display the number of points awarded.

    What I have:

    Code:
    def main():
        books = getBooks()  
        points = getPoints(books) 
        showPoints(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
        elif books >= 5:
            points =100
        return points
    def showPoints(books,points):
        print ("You bought:" ,books, "You now have: ",points) 
    main()
    I cannot seem to get this to execute correctly. I am terrible at programming, just taking this as a filler class in my graduate program because I needed one more credit hour of something to get six credit hours for full time. Any and all help would be greatly appreciated.

    Thanks!
    A.E.K.Δ.B.


  • #2
    Re: Python: Book Club Points Problem

    fixed it
    A.E.K.Δ.B.

    Comment

    Connect

    Collapse

    TeamSpeak 3 Server

    Collapse

    Advertisement

    Collapse

    Twitter Feed

    Collapse

    Working...
    X