# 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!

```        4-8-1: The following segment should print the statement, "So happy 4 you!". The blocks have been mixed up, and include two extra blocks that are not correct.  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.emotion = "So happy "
---
emotion = "So happy ' #distractor
---
print(emotion + 4 + " you!") #distractor
---
print(emotion + str(4) + " you!")
```
```        4-8-2: The following program segment should print the phrase, "My new book cost \$12.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.item = "new book"
price = "12"
---
print("My " + item + " cost \$" + price + ".")
---
print("My " item " cost \$" price ".") #paired
```
```        4-8-3: The following program segment should print the phrase, "Sarah Smith likes to swim.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.person = "Sarah Smith "
thing = "likes to swim."
---
print(person + thing)
---
print(person thing) #paired
---
print("person + thing") #paired
```
```        4-8-4: The following program segment should print the phrase, "It takes us 2 hours and 45 minutes to get home from camp.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.numHours = 2
numMinutes = 45.0
---
print("It takes us " + str(numHours) + " hours and " + str(numMinutes) + " minutes to get home from camp.")
---
print("It takes us " + numHours + " hours and " + numMinutes + " minutes to get home from camp.") #paired
```
```        4-8-5: The following program segment should print the phrase, "Lucy loves lemons.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.feeling = "loves"
---
print("Lucy" + feeling + "lemons.") #distractor
---
print("Lucy " + feeling + " lemons.")
```
```        4-8-6: The following program segment should print the phrase, "My sheepdog looks like a Muppet.". But, the blocks have been mixed up and include two extra blocks that are not correct.  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.animal = "sheepdog"
---
animal = [sheepdog] #distractor
---
animal = "sheepdog #distractor
---
print("My " + animal + " looks like a Muppet.")
```
```        4-8-7: The following program segment should print the phrase, "3 + 300 + 7 = 310.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.num1 = 3
num2 = 300
num3 = 7
ans = 310
---
print(str(num1) + " + " + str(num2) + " + " + str(num3) + " = " + str(ans))
---
print(str(num1) + str(num2) + str(num3) = str(ans)) #distractor
```
```        4-8-8: The following program segment should print the phrase, "I am a CS wizard". But, the blocks have been mixed up and include an extra block that isn't correct.  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.var1 = "I am a"
var2 = "CS wizard."
---
print(var1 + " " + var2)
---
print(var1 + var2) #paired
```
```        4-8-9: The following program segment should print the phrase, "'Red' is a primary color. So is 'blue'.". But, the blocks have been mixed up and include an extra block that isn't correct.  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.col1 = "'Red'"
col2 = "'blue'"
---
col1 = "Red"
col2 = "blue" #distractor
---
print(col1 + " is a primary color. So is " + col2 + ".")
```
```        4-8-10: The following program segment should print the phrase, "Petting dogs makes me happier than anything else.". But, the blocks have been mixed up and include several extra blocks that are not correct.  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.var1 = "dogs"
---
var1 = dogs #distractor
---
var1 = "dogs' #distractor
---
var1 = [dogs] #distractor
---
print("Petting " + var1 + " makes me happier than anything else.")
```