[Tutor] Thanks , Now able to do Marks entry and display it using Histogram

Brian van den Broek broek at cc.umanitoba.ca
Tue Jan 3 09:17:52 CET 2006


John Joseph said unto the world upon 03/01/06 02:02 AM:
> Hi All 
> Thanks to Shantanoo,Brian,Alan,Owen
>     Now I am able to  enter the marks for each
> students , and display the results  the frequency of
> marks in histogram 
>             Even though I am able to display the
> histogram of the marks with students , I  would like
> to modify it further as I learn more , I am adding the
> program which I had done 
>            Thanks to the list , I am getting more
> encouragement here ,it is fun over here 
>                              Thanks 
>                                    Joseph John 

Joseph,

great :-)

It is a friendly place to learn.

I have a suggestion about one way you might take your efforts to 
improve things.

<snip code>

> ##########
> #    To Display the histograph of the students Marks
> #    25 is the Max marks 
> #
> 
> for j in range(25):
>         #print j , "is ",array.count(j)
>         print j,"x" * array.count(j)
>         j += 1

Hard-coded magic numbers like 25 here are something it often pays to 
eliminate. If you know that every test or assignment for the entire 
future of time is out of 25, then it is fine. But, you can plan for 
the future and be more general by trying to accommodate varying point 
totals.

If you try that and get stuck, post about it.

Good luck with however you choose to improve your approach.

Best,

Brian vdB


More information about the Tutor mailing list