| | |
I need help please
Thread Solved |
•
•
Join Date: Feb 2009
Posts: 5
Reputation:
Solved Threads: 0
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()
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()
•
•
Join Date: Feb 2009
Posts: 5
Reputation:
Solved Threads: 0
[code]
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()
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()
•
•
Join Date: Feb 2009
Posts: 5
Reputation:
Solved Threads: 0
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()]
[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()]
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
Note, all are without Quotes
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Here we go:
python Syntax (Toggle Plain Text)
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()
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Okay here is a version with a lot of things fixed:
python Syntax (Toggle Plain Text)
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()
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Other Threads in the Python Forum
- Previous Thread: Search and replace multiple file
- Next Thread: A Print function for different versions of python
| Thread Tools | Search this Thread |
accessdenied advanced apache application argv array beginner book builtin calculator change command converter countpasswordentry csv curved dan08 def dictionary dynamic edit enter event file float format function google homework import inches input jaunty java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysqlquery newb number numbers numeric obexftp output parameters parsing path phonebook plugin prime programming py2exe pygame pyopengl python random recursion redirect remote return reverse scrolledtext session simple skinning software sprite statictext string strings syntax table terminal text textarea threading time tlapse trick tuple tutorial twoup ubuntu unicode unit urllib urllib2 variable voip wordgame wxpython






