Python math program help

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Re: Python math program help

Post by Gatito on Sun May 08, 2011 5:18 pm
([msg=57156]see Re: Python math program help[/msg])

It certainly works, but it doesn't feel complete yet.

The way you wrote it you must know beforehand which number to type first,second.... in order to find the right value for max & min.

You should make your program take the values from the user by typing them rather than from the script itself. You also may want to store them in an array ( or a list maybe? ) and use some build-in sort function.

Now that you have them sorted you should use jgreen45's algorithm ( with a slight modification in order ) and implement it to find always the max & min values correctly regardless of what the user types.

You can even go further and maybe even put some input validation code so the user gets an error message displayed to him when he types a number not between 0-9 or characters.
User avatar
Gatito
Poster
Poster
 
Posts: 113
Joined: Tue Mar 08, 2011 12:55 pm
Blog: View Blog (0)


Re: Python math program help

Post by AllByte on Sat May 14, 2011 8:04 pm
([msg=57403]see Re: Python math program help[/msg])

Gatito wrote:It certainly works, but it doesn't feel complete yet.

The way you wrote it you must know beforehand which number to type first,second.... in order to find the right value for max & min.

You should make your program take the values from the user by typing them rather than from the script itself. You also may want to store them in an array ( or a list maybe? ) and use some build-in sort function.

Now that you have them sorted you should use jgreen45's algorithm ( with a slight modification in order ) and implement it to find always the max & min values correctly regardless of what the user types.

You can even go further and maybe even put some input validation code so the user gets an error message displayed to him when he types a number not between 0-9 or characters.


Yeah i know, I'm working on it right now and i've done some of that already. I just wanted to get the jist of it first.
AllByte
New User
New User
 
Posts: 8
Joined: Thu May 05, 2011 7:47 pm
Blog: View Blog (0)


Previous

Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests

cron