This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-12-11 15:58:16

thelasthorizon
Scratcher
Registered: 2008-08-19
Posts: 100+

List Issues

I want to make a project that orders inputed numbers in ascending order but what i did is said "when 0 key pressed add 0 to active input". I did that for all numbers. When i enter two numbers it come up as 2 then below it 3 in the active input list. Then when you press space it adds active input to a list called input which is where it stores all of the inputs. But what happens is when i puts say 2 and 3 in instead of being 23 is comes up as 2 3 which you can't say if it is greater or less than anything else. Anyone got an answer to my problem.

Offline

 

#2 2008-12-11 19:26:47

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: List Issues

I'm not sure I exactly understand your problem...it sounds like you are trying to use a list to collect digits of a number and then using the full contents of the list to make a number in a variable (or another list element).  And you are running into the problem that you end up with spaces between the list elements.  I have not figured out a way to remove those spaces; sorry.

To input a multi-digit number, I initialize a variable to 0 and then, for each digit key, have it set the variable to  the current value of the variable multiplied by 10 plus the value of the digit:

    Set Variable = (10 * Variable) + Digit key pressed

So if the key "2" was pressed you would get

    Variable = (10 * 0) + 2 = 2

And then the key "3" was pressed you would get

    Variable = (10 * 2) + 3 = 23

So the multi-digit number is taking form in Variable


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-12-11 19:43:34

thelasthorizon
Scratcher
Registered: 2008-08-19
Posts: 100+

Re: List Issues

ok thanks     do you know of any other free software that is targeted at mathematical equations. My project would be to find the mean, median, and mode of a list of data. I thought that it was time consuming doing it on your own but it would be simple in a program. If you know of any programming languages let me know.


                                       Thanks,

                                                  Thelasthorizon

Offline

 

#4 2008-12-11 22:16:38

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: List Issues

thelasthorizon wrote:

ok thanks     do you know of any other free software that is targeted at mathematical equations. My project would be to find the mean, median, and mode of a list of data. I thought that it was time consuming doing it on your own but it would be simple in a program. If you know of any programming languages let me know.


                                       Thanks,

                                                  Thelasthorizon

Python is free and has lists.  It is a text based language but fairly forgiving to use.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#5 2008-12-13 08:34:26

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: List Issues

speaking of mean, median, and mode, I made a project to calculate just that.
http://scratch.mit.edu/projects/bhz/349843

Offline

 

Board footer