[Tutor] Basic Python help

boB Stepp robertvstepp at gmail.com
Fri Sep 4 21:08:26 EDT 2020


On Fri, Sep 04, 2020 at 10:40:24AM -0500, Mason Jordan wrote:

Greetings Mason!

>Write a Python program that calculates summary statistics about a class
>assignment. First, prompt the user for the number scores to be entered,

Do you know how to get user "input"?  What data type will you get?  Will
you need to convert it to another data type?

>which should be a positive integer. Reprompt for 0 or negative integers.

How will you determine "if" the number entered is positive, negative or zero?

>Then prompt for each score, re-prompting for values outside the range 0 -
>100, inclusive...

How can you "loop" back and re-prompt for "input"?  Again, how can you tell
"if" a number is "<" 0 or ">=" 100?  How will you know when to end your
looping behavior?

How will you store your entered scores or "list" them as needed?

> ...Finally, display the minimum, maximum and average scores.

Does any Python data structure exist for a "list" of scores that handily
has methods that will compute the "max", "min" and "sum" of such scores?

>I have a little bit of the code written. Can anyone offer any help?

Sure, there are plenty of people here willing to help you, but we will not
do your homework for you.  The idea is you show your efforts -- copy and
paste your code into a plain text email -- and, likewise, copy and paste
any error/exception tracebacks into your email.  State what you expected to
get.  Usually it is helpful to mention your operating system and Python
version.  Based on where you seem to be stuck, someone will give you
pointers to get you over that hurdle.

You indicate you have some code already written.  Copy and paste it into a
follow-up email along with any error tracebacks and tell us what you are
struggling with.

Good luck!

-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list