| | |
urgent help
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 38
Reputation:
Solved Threads: 0
python Syntax (Toggle Plain Text)
total = 0 max_score = -1 min_score = 100000000 total_numbers = 0 x = 0 y = 0 print("Enter a list of numbers, (Enter -1 to stop) ") print ("Press the enter key after entering each number") print ("End the list by entering -1") print () number = int(input("")) while number != -1: total = total + number if number > max_score: max_score = number if number < min_score: min_score = number total_numbers = total_numbers + 1 average = total / total_numbers if x < average: x = x + 1 if number <= 50: y = y + 1 number = int(input("")) continue print () print ("You have entered " + str(total_numbers) + " scores ") print () print ("The top score is " + str(max_score)) print () print ("The lowest score is " + str(min_score)) print () print ("The class average is %0.3f " % (average)) print () print (str(x) + " students scored above the class average ") print (str(y) + " students passed the final exam ") while 1: print () if 'y' in input("Do you want to run the program again? (y/n) "): pass else: print () print ('Thank you for using this program!') print () print ('Goodbye!') break print("Enter a list of numbers, (Enter -1 to stop) ") print ("Press the enter key after entering each number") print ("Signal the end of the list by entering -1") print () number = int(input("")) max_score = -1 min_score = 100000000 total = 0 total_numbers = 0 x = 0 y = 0 while number != -1: total = total + number if number > max_score: max_score = number if number < min_score: min_score = number total_numbers = total_numbers + 1 average = total / total_numbers if x < average: x = x + 1 if number <= 50: y = y + 1 number = int(input("")) continue print () print ("You have entered " + str(total_numbers) + " scores ") print () print ("The top score is " + str(max_score)) print () print ("The lowest score is " + str(min_score)) print () print ("The class average is %0.3f " % (average)) print (str(x) + " students scored above the class average ") print (str(y) + " students passed the final exam ")
how many people scored above average - how do i find this?
how many people passed the course (i.e. scored >= 50) - how do i find this?
Please help, thanks
Tony
Last edited by vegaseat; Jun 26th, 2009 at 10:04 pm. Reason: added code tags
PLEASE! Use [code=python][/code] tags! If you look at your post, you realize your Python code has no indentation anymore, and indentation is a crucial part of Python. I'm not going to bother looking through your code until you edit that post and put your code in those tags to preserve the spacing.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson
my photography
- Hunter S. Thompson
my photography
•
•
•
•
Are you using a 32-bit compiler or a 16-bit?
If 16-bit then you have a problem!
100000000
is 05f5e100 in hex requiring 32-bits to store. Since you are being signed due to the -1, It seems a Highes score of 32767 would be a more suitable test, IFF you are using a 16-bit compiler!
May 'the Google' be with you!
![]() |
Similar Threads
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
- URGENT: Need help on I/O code! (Java)
- Urgent help (Networking Hardware Configuration)
- Homepage keeps switching back to a porn site (Web Browsers)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the Python Forum
- Previous Thread: Cheat card game python project
- Next Thread: easy homework help
Views: 269 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied alarm aliased basic beginner casino character code corners cursor definedlines development dictionary digital dynamic editing error events examples excel exe file filename float format ftp function graphics gui handling homework ideas iframe import input java line linux list lists logging loop matching mouse newb number numbers numeric output parameters parsing path port prime program programming progressbar projects py py2exe pygame pyglet pyqt pysimplewizard python random recursion recursive return reverse schedule scrolledtext searchingfile shebang skinning sprite ssh statistics stdout string strings table tails terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode urllib urllib2 variable voip windows wxpython






