Mixed-up Code Questions¶

Create code that first sets the variable x to 3, then sets the variable y to the string “hello”, and then sets the variable z to the string “Python”. Then set x_type, y_type, and z_type to the types of each of these variables. For example, x_type = int. The blocks have been mixed up and include extra blocks that aren’t correct.

Write code that sets the variable x to 3, the variable y to the string “hello”, and the variable z to the string “Python”. Then set x_type, y_type, and z_type to the types of each of these variables. For example, x_type = int.

Create code that sets Carla to the sentence “Carla ate 4 apples.”. The blocks have been mixed up and include extra blocks that aren’t correct.

Write code that sets Carla to the the sentence “Carla ate 4 apples.”. Use the variables number and fruit.

Create code that calculates John’s gross pay for a certain week and inputs it into grossPay given that he worked 45 hours that week, earned 10 dollars per hour, and recieved a 5 percent bonus of his salary that week. The blocks have been mixed up and include extra blocks that aren’t correct.

Write code that calculates John’s gross pay for a certain week and inputs it into grossPay given that he worked 45 hours that week, earned 10 dollars per hour, and recieved a 5 percent bonus of his salary that week. Hint: gross pay is equal to the number of hours worked times pay rate.

Create code that stores the cost of each shirt in the variable pricePerShirt if John purchases 2 shirts and gets the third free with each shirt originally costing $45. The blocks have been mixed up and include an extra block that isn’t correct. Write code that stores the cost of each shirt in the variable pricePerShirt if John purchases 2 shirts and gets the third free with each shirt originally costing$45. Use the variable price.

Create code that assigns the cost per person for a dinner to perPersonCost. tip is a percentage of the bill. The blocks have been mixed up and include an extra block that isn’t needed in the solution.

Write code that assigns the cost per person for a dinner to perPersonCost. The bill is 45 dollars and the tip is 19 percent of the bill. The cost per person will be divided equally.

Create code that swaps the values of x and y. The blocks have been mixed up and include an extra block that isn’t needed in the solution.

Write code that swaps the values of x and y using a temporary variable.

Create code that assigns the final price you will have to pay for an item that is 60% off the original price of $52.99 to finalPrice. The blocks have been mixed up and include extra blocks that aren’t needed in the solution. Write code that assigns the final price you will have to pay for an item that is 60% off the original price of$52.99 to finalPrice.

Create code that sets cookies to the sentence “Chris likes baking cookies more than anything.”. The blocks have been mixed up and include extra blocks that aren’t correct.

Write code that sets cookies to the sentence “Chris likes baking cookies more than anything.”. Use the variables var1 and var2.

Create code that sets var to the sentence “It takes us 165 minutes to get home from camp.”. Then append the sentence “165 minutes is also 2 hours and 45 minutes.” to the variable. The blocks have been mixed up and include extra blocks that aren’t correct.

Write code that sets var to the sentence “It takes us 165 minutes to get home from camp.”. Then append the sentence “165 minutes is also 2 hours and 45 minutes.” to the variable. Use the variables numHours and numMinutes.

Create code that sets num_quarters to the maximum number of quarters you can provide as change if your friend owed you 17.42 dollars but gave you 20 dollars. The blocks have been mixed up and include an extra block that isn’t correct.

Write code that sets num_quarters to the maximum number of quarters you can provide as change if your friend owed you 17.42 dollars but gave you 20 dollars.