<snapdata remixID="9211649"><project name="U5L1 Page 2&amp;3-Algorithms" app="Snap! 5.4, http://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAG2SURBVHhe7dcxakJBFEDRMS5FcD8WVu7GvQiCtdsR3IYIxoRfSMAETMJtzmn+m6kvf2Zmt7sBkbfpCwkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhIgKQGSEiApAZISICkBkhLgE4vFYux2u2nFf5nd7qaZL1ar1TSNcTqdxuFwGMvlctrhLwjwB48RPrpcLuN4PE4rXuUIfsF8Pp8mfssf8Bvr9Xpcr9fP+Xw+j/1+7wj+YwJ84uMRst1ux2azmXb4DwIk5Q5ISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCkBEhKgKQESEqApARISoCExngHa3czNKhQh4YAAAAASUVORK5CYII=</thumbnail><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="true" codify="false" inheritance="true" sublistIDs="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK1SURBVHhe7cExAQAAAMKg9U9tDB8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIsajf4AAXBXLv8AAAAASUVORK5CYII=</pentrails><costumes><list struct="atomic" id="2"></list></costumes><sounds><list struct="atomic" id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="0" y="0" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="8"><costumes><list struct="atomic" id="9"></list></costumes><sounds><list struct="atomic" id="10"></list></sounds><blocks></blocks><variables></variables><scripts><script x="20" y="10"><custom-block s="Position of number %n in unsorted list %l"><l>99</l><block s="reportNewList"><list><l>20</l><l>12</l><l>3</l><l>100</l><l>50</l><l>12</l></list></block></custom-block></script><script x="20" y="46.99999999999994"><custom-block s="Position of number %n in sorted list %l"><l>100</l><block s="reportNewList"><list><l>20</l><l>12</l><l>3</l><l>100</l><l>50</l><l>12</l></list></block></custom-block></script><script x="20" y="80"><custom-block s="Are the number of %l distinct"><block s="reportNewList"><list><l>20</l><l>12</l><l>3</l><l>100</l><l>50</l><l>50</l></list></block></custom-block></script><script x="18" y="127"><custom-block s="Duplicates in %l"><block s="reportNewList"><list><l>20</l><l>12</l><l>3</l><l>100</l><l>50</l></list></block></custom-block></script><script x="17" y="176"><custom-block s="Remove Duplicates from %l"><block s="reportNewList"><list><l>20</l><l>12</l><l>3</l><l>100</l><l>50</l><l>50</l></list></block></custom-block></script></scripts></sprite></sprites></stage><hidden></hidden><headers></headers><code></code><blocks><block-definition s="Position of number %&apos;number&apos; in unsorted list %&apos;List&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doFor"><l>Position</l><l>1</l><block s="reportListLength"><block var="List"/></block><script><block s="doIf"><block s="reportEquals"><block s="reportListItem"><block var="Position"/><block var="List"/></block><block var="number"/></block><script><block s="doReport"><block var="Position"/></block></script></block></script><comment w="90" collapsed="false">The code will examine the numbers from one to how many numbers there are in the list. If the postition of the list is equal to the number to user inputted, It will try to find the number the user said, if it cant find it it will report &quot;That number is not in the list.&quot;</comment></block><block s="doReport"><l>That number is not in the list</l></block></script></block-definition><block-definition s="Awful list" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs></inputs><script><block s="doReport"><block s="reportNewList"><list><l>1</l><l>7</l><l>8</l><l>9</l><l>11</l><l>12</l><l>21</l><l>22</l><l>23</l><l>24</l><l>73</l><l>73</l><l>96</l><l>99</l></list></block></block></script></block-definition><block-definition s="Position of number %&apos;Number&apos; in sorted list %&apos;list&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%n"></input><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportListContainsItem"><block var="list"/><block var="Number"/></block><script><block s="doDeclareVariables"><list><l>Item Number</l></list><comment w="139" collapsed="false">The script variable is used to report the item number that the user is looking for. If the average number of the list is greater than the number the user is looking for,it will go to the highest number and change it by 1 until the number is found..</comment></block><block s="doIf"><block s="reportEquals"><block s="reportGreaterThan"><custom-block s="Average of %l"><block var="list"/></custom-block><block var="Number"/></block><block s="reportBoolean"><l><bool>true</bool></l></block></block><script><block s="doSetVar"><l>Item Number</l><l>0</l></block><block s="doForEach"><l>item</l><block s="reportKeep"><block s="reifyPredicate"><autolambda><block s="reportLessThan"><l></l><custom-block s="Average of %l"><block var="list"/></custom-block></block></autolambda><list></list></block><block var="list"/></block><script><block s="doChangeVar"><l>Item Number</l><l>1</l></block><block s="doIf"><block s="reportEquals"><block var="item"/><block var="Number"/></block><script><block s="doReport"><block var="Item Number"/></block></script></block></script></block></script></block><block s="doIf"><block s="reportEquals"><block s="reportLessThan"><custom-block s="Average of %l"><block var="list"/></custom-block><block var="Number"/></block><block s="reportBoolean"><l><bool>true</bool></l></block><comment w="134" collapsed="false">If the average of the list is less than the number is the user is looking for, it will then make a new list and and change the value by 1 until the number is found. </comment></block><script><block s="doSetVar"><l>Item Number</l><l>0</l></block><block s="doForEach"><l>item</l><block s="reportKeep"><block s="reifyPredicate"><autolambda><block s="reportGreaterThan"><l></l><custom-block s="Average of %l"><block var="list"/></custom-block></block></autolambda><list></list></block><block var="list"/></block><script><block s="doChangeVar"><l>Item Number</l><l>1</l></block><block s="doIf"><block s="reportEquals"><block var="item"/><block var="Number"/></block><script><block s="doReport"><block s="reportSum"><block var="Item Number"/><block s="reportListLength"><block s="reportKeep"><block s="reifyPredicate"><autolambda><block s="reportLessThan"><l></l><custom-block s="Average of %l"><block var="list"/></custom-block></block></autolambda><list></list></block><block var="list"/></block></block></block></block></script></block></script></block></script></block><block s="doIf"><block s="reportEquals"><block s="reportEquals"><custom-block s="Average of %l"><block var="list"/></custom-block><block var="Number"/></block><block s="reportBoolean"><l><bool>true</bool></l></block><comment w="90" collapsed="false">If the average number of the list is equal to the number, it will report the number.</comment></block><script><block s="doSetVar"><l>Item Number</l><l>0</l></block><block s="doForEach"><l>item</l><block s="reportKeep"><block s="reifyPredicate"><autolambda><block s="reportGreaterThan"><l></l><custom-block s="Average of %l"><block var="list"/></custom-block></block></autolambda><list></list></block><block var="list"/></block><script><block s="doChangeVar"><l>Item Number</l><l>1</l></block><block s="doIf"><block s="reportEquals"><block var="item"/><block var="Number"/></block><script><block s="doReport"><block var="Item Number"/></block></script></block></script></block></script></block></script><script><block s="doReport"><l>0</l><comment w="90" collapsed="false">This will only happen if the number that is being looked for is not in the list..</comment></block></script></block></script></block-definition><block-definition s="Average of %&apos;List&apos;" type="reporter" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportMonadic"><l><option>floor</option></l><block s="reportQuotient"><block s="reportCombine"><block var="List"/><block s="reifyReporter"><autolambda><block s="reportSum"><l></l><l></l></block></autolambda><list></list></block></block><block s="reportListLength"><block var="List"/></block></block></block></block></script></block-definition><block-definition s="Are the number of %&apos;list&apos; distinct" type="predicate" category="operators"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doDeclareVariables"><list><l>T/F</l><l>New List</l></list></block><block s="doSetVar"><l>New List</l><block var="list"/></block><block s="doSetVar"><l>T/F</l><block s="reportNewList"><list></list></block></block><block s="doRepeat"><block s="reportListLength"><block var="list"/><comment w="90" collapsed="false">This code will repeat as many times as needed. If all the numbers but the first numbers contain the same number, it will add 1 to T/F.</comment></block><script><block s="doIfElse"><block s="reportListContainsItem"><block s="reportCDR"><block var="New List"/></block><block s="reportListItem"><l>1</l><block var="New List"/></block></block><script><block s="doAddToList"><l>1</l><block var="T/F"/></block></script><script><block s="doAddToList"><l>0</l><block var="T/F"/></block></script></block><block s="doSetVar"><l>New List</l><block s="reportCDR"><block var="New List"/></block></block></script></block><block s="doIfElse"><block s="reportListContainsItem"><block var="T/F"/><l>1</l><comment w="90" collapsed="false">If T/F contains 1, then the numbers ae not distinct. If it doesn&apos;t contain 1, it is distinct.</comment></block><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script></block></script></block-definition><block-definition s="Duplicates in %&apos;List&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doIfElse"><block s="reportEquals"><custom-block s="Are the number of %l distinct"><block var="List"/></custom-block><block s="reportBoolean"><l><bool>false</bool></l></block></block><script><block s="doDeclareVariables"><list><l>Duplicates</l><l>New List</l></list></block><block s="doSetVar"><l>Duplicates</l><block s="reportNewList"><list></list></block></block><block s="doSetVar"><l>New List</l><block var="List"/></block><block s="doForEach"><l>item</l><block var="New List"><comment w="116" collapsed="false">If the first item of the list contains any numbers in the rest of the list, it will add the item to the duplicate and repeat it for each item and will make a new list to repeat for every other item.</comment></block><script><block s="doIf"><block s="reportListContainsItem"><block s="reportCDR"><block var="New List"/></block><block s="reportListItem"><l>1</l><block var="New List"/></block></block><script><block s="doAddToList"><block var="item"/><block var="Duplicates"/></block></script></block><block s="doSetVar"><l>New List</l><block s="reportCDR"><block var="New List"/></block></block></script></block><block s="doReport"><block var="Duplicates"><comment w="167" collapsed="false">This will report the duplicates</comment></block></block></script><script><block s="doReport"><l>No Duplicates</l><comment w="128" collapsed="false">If there is no duplicates, it will report no duplicates.</comment></block></script></block></script></block-definition><block-definition s="Remove Duplicates from %&apos;List&apos;" type="reporter" category="lists"><header></header><code></code><translations></translations><inputs><input type="%l"></input></inputs><script><block s="doDeclareVariables"><list><l>New List</l></list></block><block s="doSetVar"><l>New List</l><block var="List"/></block><block s="doRepeat"><block s="reportListLength"><custom-block s="Duplicates in %l"><block var="List"/><comment w="90" collapsed="false">This will repeat as many times as there are duplicates..</comment></custom-block></block><script><block s="doDeleteFromList"><custom-block s="Position of number %n in unsorted list %l"><block s="reportListItem"><l>1</l><custom-block s="Duplicates in %l"><block var="List"/></custom-block></block><block var="List"/></custom-block><block var="New List"/></block></script></block><block s="doReport"><block var="New List"/></block></script></block-definition></blocks><variables></variables></project><media name="U5L1 Page 2&3-Algorithms" app="Snap! 5.4, http://snap.berkeley.edu" version="1"></media></snapdata>