## Practice Quiz: Expressions and Variables

#### 1. This code is supposed to display "2 + 2 = 4" on the screen, but there is an error. Find the error in the code and fix it, so that the output is correct.print("2 + 2 = " + (2 + 2))

• ```print("2 + 2 = " + str(2 + 2)) ```

#### 2. In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends decide to split the bill evenly between them, after adding 15% tip for the service. Calculate the tip, the total amount to pay, and each friend's share, then output a message saying "Each person needs to pay: " followed by the resulting number.bill = ___ # Assign "bill" variable with bill amounttip = bill * ___ # Multiply by stated tip rate total = bill + ___ # Sum the "total" of the "bill" and "tip"share = ___ # Divide "total" by number of friends diningprint("___" + ___) # Enter the required string and "share" # Hint: Remember to convert incompatible data types

• bill = 47.28
tip = bill * 0.15
total = bill + tip num_friends = 2
share = total / num_friends
print(“Each person needs to pay: \$” + str(share))

#### 3. This code is supposed to take two numbers, divide one by another so that the result is equal to 1, and display the result on the screen. Unfortunately, there is an error in the code. Find the error and fix it, so that the output is correct.numerator = 10denominator = 0result = numerator / denominatorprint(result)

• numerator = 10
denominator = numerator
result = numerator / denominator
print(result)

#### 4. Combine the variables to display the sentence "How do you like Python so far?" word1 = "How"word2 = "do"word3 = "you"word4 = "like"word5 = "Python"word6 = "so"word7 = "far?"print(___)

• print(word1 + ” ” + word2 + ” ” + word3 + ” ” + word4 + ” ” + word5 + ” ” + word6 + ” ” + word7)

#### 5. What do you call a combination of numbers, symbols, or other values that produce a result when evaluated?

• An explicit conversion
• An expression
• A variable
• An implicit conversion