Answer to Question #16333 in Python for david

Question #16333
Serendipity Booksellers has book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows:
• If a customer purchases 0, he or she earns 0 points
• If a customer purchases 1, he or she earns 5 points
• If a customer purchases 2, he or she earns 7.5 points per book
• If a customer purchases 3, he or she earns 10 points per book
• If a customer purchases 4 or more books, he or she earns 15 points per book
• Write a program that asks the user to enter the number of books that he or she has purchased this month and displays the number of points awarded.
• The output should state the number of books and the total points awarded
1
Expert's answer
2012-10-12T11:23:32-0400
num = input ("Please enter number of books: ")

points = 0

if num
== 1:
points = 5 * num
elif num == 2:
points = 7.5 * num
elif num ==
3:
points = 10 * num
elif num >= 4:
points = 15 * num

print
("Points: "+str(points))
print ("Books: "+str(num))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS