You should probably convert scores to ints on input. At any rate, here is your problem:
low_tscore = min(tscore1,tscore2,tscore3,tscore4,tscore5) You need to convert tscore1, etc. to ints, otherwise min will give lexical comparison (alphabetic order), not numeric order On Mon, Sep 19, 2016 at 7:01 PM, Gampper, Terry <tgamp...@mccneb.edu> wrote: > Hello > I started my journey with Python last week and find it to be an easy-to-learn > language. I am currently teaching introduction to computer programming. One > of the assignments we are working on involves an instructor giving a series > of 5 tests, and the lowest score is dropped, then calculating the percent. > Here is my attempt at coding: > > name = input("Enter Student's Name: " ) > tscore1 = input ("Enter test score 1: ") > tscore2 = input ("Enter test score 2: ") > tscore3 = input ("Enter test score 3: ") > tscore4 = input ("Enter test score 4: ") > tscore5 = input ("Enter test score 5: ") > total_tscore = int(tscore1) + int(tscore2) + int(tscore3) + int(tscore4) + > int(tscore5) > low_tscore = min(tscore1,tscore2,tscore3,tscore4,tscore5) > adjusted_tscore = int(total_tscore) - int(low_tscore) > percent = int(adjusted_tscore/400*100) > print("The sum of the 5 tests is",total_tscore) > print("The lowest test score is thrown out",low_tscore) > print("The adjusted score is",adjusted_tscore) > print("Student",name, "has a score of",percent, "percent") > > I ran the program several times using random numbers and I found that the > results were not consistent. Here are a couple of runs: > > ============ RESTART: /Users/tgampper/Documents/Python/assign2.py ============ > Enter Student's Name: Joe > Enter test score 1: 78 > Enter test score 2: 89 > Enter test score 3: 90 > Enter test score 4: 78 > Enter test score 5: 99 > The sum of the 5 tests is 434 > The lowest test score is thrown out 78 > The adjusted score is 356 > Student Joe has a score of 89 percent >>>> > ============ RESTART: /Users/tgampper/Documents/Python/assign2.py ============ > Enter Student's Name: Sally > Enter test score 1: 78 > Enter test score 2: 89 > Enter test score 3: 90 > Enter test score 4: 78 > Enter test score 5: 100 > The sum of the 5 tests is 435 > The lowest test score is thrown out 100 > The adjusted score is 335 > Student Sally has a score of 83 percent >>>> > > Notice the scores for test 5 for each student. My conclusion is that if the > score is <100, the lowest score is properly displayed, but if the score is > >=100, then the lowest score is equal to the highest score. Doesn't make > sense to me. Do you have any ideas? Thanks! > -- > Terry Gampper > Adjunct INFO Instructor > Metropolitan Community College, Omaha NE > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor