1. Write this Boolean statement in the form of a conditional (if/else) statement: stayInside⟵((isCold) OR (isRaining))
isRaining = False
isCold = False
if isRaining or isCold: 
    stayInside = True
else:
    stayInside = False
  1. Create an algorithm that uses selection and/or iteration that will represent one player’s complete turn.

    During a turn, each player gets 4 attempts/chances to get the greatest number possible. During each attempt, the player will use a random number generator to select a random number from 1 to 10. After they have had 4 chances, their score is the greatest number they received from the random number generator, and their turn is over.

import random

score = -1
for x in range(4):
    randomNum = random.randint(1, 10) 
    if(randomNum>score):
        score = randomNum
print("Score: " + str(score))
Score: 9
  1. Create an algorithm that will allow the arrow to reach the gray square:

repeatUntil(objectiveReached):
_if(pos == [4, 1] || [4, 6]):
__
turnRight()
___moveForward()

  1. Make a binary search tree of different the list [1,2,3,4,6,9,11,69]
  2. Explain thoroughly how to find the number 69 in the list above (use key words) First, the algorithm would start the first interaction and see that 69 is on the right of the center. Next, it would see that it is to the right of 3/4 into the list, and finally would see that 69 is the rightmost index.
  3. Make a diagram explaining how you found the list (not tree, include equation)

69>((4+6)/2)
69>((9+11)/2)
69>((11+69)/2)

  1. Put this list of strings in a order that can be used for binary search [“store”,”Market”,”Walmart”,Target”,”Ralphs”] ["Market", "Ralphs", "Target", "Walmart", "store"]
  2. Explain why Binary Search is more efficient than Sequential Search Binary search allows you to not have to look through every index by only looking on the side that you know has the value
  3. [64,36,16,11,9] Explain which number you are finding, how many check it would take, and make a binary search tree To find 16 it would take one check