# Mixed Up Code Practice¶

Try to solve each of the following. Click the Check Me button to check each solution. You will be told if your solution is too short, has a block in the wrong order, or you are using the wrong block. Some of the problems have an extra block that isn’t needed in the correct solution. Try to solve these on your phone or other mobile device!

```        3-11-1: The following program segment should print out the cost for each shirt if they are to buy 2 and get the third free but were originally \$45 each.  The blocks have been mixed up.  Drag the blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.price = 45
---
totalCost = price * 2
---
pricePerShirt = totalCost / 3
---
print(pricePerShirt)
```
```        3-11-2: The following program segment should print out the cost per person for a dinner including the tip. But the blocks have been mixed up and include an extra block that isn't needed in the solution. But, the blocks have been mixed up and include an extra block that isn't needed in the solution. Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.bill = 89.23
---
tip = bill * 0.20
---
total = bill + tip
---
numPeople = 3
perPersonCost = total / numPeople
---
print(perPersonCost)
---
print(perpersoncost) #distractor
```
```        3-11-3: The following program segment should print the amount of punch left in a two gallon punch bowl if 12oz is poured into as many cups as possible. One gallon contains 128oz and the punch bowl is full. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.oInGallon = 128
oInCup = 12
---
totalPunch = 2 * oInGallon
---
amountLeft = totalPunch % oInCup
---
print(amountLeft)
---
amountLeft = totalPunch / oInCup #distractor
```
```        3-11-4: The following program segment should print the number of seconds in 5 days. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.sInMin = 60
mInHour = 60
hInDay = 24
---
sInDay = sInMin * mInHour * hInDay
---
total = sInDay * 5
---
print(total)
---
total = sInDay / 5 #distractor
```
```        3-11-5: The following program segment should print the number of months it would take you to save 500 if you make 50 a week. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.weeklyRate = 50
goal = 500
---
numWeeks = goal / weeklyRate
---
numMonths = numWeeks / 4
---
print(numMonths)
---
numWeeks = weeklyRate / goal #distractor
```
```        3-11-6: The following program segment should print the cost of a trip that is 200 miles when the price of gas is 2.20 and the miles per gallon is 42. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.miles = 200
price = 2.20
mpg = 42
---
numGalls = miles / mpg
---
cost = numGalls * price
---
print(cost)
---
print(totalCost) #distractor
```
```        3-11-7: The following program segment should print how many miles you can go on half a tank of gas if the miles per gallon is 26 and your tank holds 15 gallons. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.mpg = 26
tankHolds = 15
---
numGalls = tankHolds / 2
---
miles = numGalls * mpg
---
print(miles)
---
mpg = 15
tankHolds = 26 #distractor
```
```        3-11-8: The following program segment should print how many chicken wings you can buy with \$3.50 if the wings are \$.60 each. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.cost = 0.6
money = 3.5
---
numWings = cost / money
---
print(numWings)
---
print(NumWings) #distractor
```
```        3-11-9: The following program segment should print how much you will have to pay for an item that is 60% off the original price of \$52.99. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.price = 52.99
discount = 0.6
---
savings = price * discount
---
finalPrice = price - savings
---
print(finalPrice)
---
finalPrice = price - discount #distractor
```
```        3-11-10: The following program segment should print how much each pair of shorts cost when they are buy 2 and get the third free.  The shorts are originally \$39.99 each. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.price = 39.99
---
priceForTwo = price * 2
---
itemPrice = priceForTwo / 3
---
print(itemPrice)
---
itemPrice = priceForTwo / 2 #distractor
```
```        3-11-11: Arrange the code so the following is displayed in order: 55, "computer science", 0. The blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.apple <- "computer science"
number <- 55
Michigan <- 0
---
DISPLAY(number)
---
DISPLAY(apple)
---
DISPLAY(Michigan)
---
DISPLAY(0) #distractor
```
```        3-11-12: The following program segment should swap the values of x and y after val1 and val 2 are assigned to x and y, respectively. But, the blocks have been mixed up and include an extra block that isn't needed in the solution.  Drag the needed blocks from the left and put them in the correct order on the right.  Click the Check Me button to check your solution.x <- val1
y <- val2
---
temp <- x
---
x <- y
---
y <- temp
---
temp <- y #distractor
```