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

#1 2012-03-04 09:31:40

tommyying
New Scratcher
Registered: 2012-03-04
Posts: 3

Need your Help Please, I'm a new learner.

I have a question:
Write a Scratch script to input a list of number one by one. The input should end by entering the word "done". Then, find out and display (by "say") the sum of all even numbers in the input list and also the sum of all odd numbers in the input list. (Note, the user should enter the list of numbers only once and your program should able to find out the required two pieces of information).

I can't show the even number and odd number and there is some bug when I add all the number too  sad  I know it's simple but I'm stupid Pls write a sample to me. Thx for your help!

Offline

 

#2 2012-03-04 09:34:59

tommyying
New Scratcher
Registered: 2012-03-04
Posts: 3

Re: Need your Help Please, I'm a new learner.

I have a question:
Write a Scratch script to input a list of number one by one. The input should end by entering the word "done". Then, find out and display (by "say") the sum of all even numbers in the input list and also the sum of all odd numbers in the input list. (Note, the user should enter the list of numbers only once and your program should able to find out the required two pieces of information).

I can't show the even number and odd number and there is some bug when I add all the number too  sad  I know it's simple but I'm stupid Pls write a sample to me. Thx for your help!

Offline

 

#3 2012-03-04 09:37:13

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: Need your Help Please, I'm a new learner.

First i would like to say that second paragraph is very negative.  tongue
Saying you cant do it and calling yourself stupid will only make you think that way, making it worse.  tongue

Second... can you upload the game so i can see the script you currently have? I would rather edit a script than start from 'Scratch'. (pun intended  tongue )

Thanks,
Pec


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

#4 2012-03-04 09:39:44

wjack2010
Scratcher
Registered: 2010-06-28
Posts: 100+

Re: Need your Help Please, I'm a new learner.

Use scratchblocks to display the script here ^^

Offline

 

#5 2012-03-04 09:49:45

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: Need your Help Please, I'm a new learner.

This belongs in Help with Scripts. I'll request to get it moved for you.


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#6 2012-03-04 11:02:02

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

Re: Need your Help Please, I'm a new learner.

I can move it to Help with Scripts for you.  Since it sounds like a homework assignment, I don't think we should just give you the scripts.  But I can give you some help with the odd/even number issue. 

One way to tell is to divide the number in two, round it to an integer, then multiply by two and see if you get the same number you started from.  If you do, you have an even number

if <([2] * (round ((i) / (2)))) = (i)>
say [Even!] for (1) secs
else
say [Odd!] for (1) secs
end
Another way to do the same thing is to use the Mod function, which returns the remainder of a division

if < ((i) mod (2))  = (0)>
say [Even!] for (1) secs
else
say [Odd!] for (1) secs
end


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

Offline

 

Board footer