Here is the solution for Hello World | Crash Course on Pyhton by Google, Expressions and Variables practice quiz solution. PPractice Quiz: Expressions and Variables Solution. Google IT Automation with Python Professional Certificate All question and answers are given below
Crash Course on Python Expression and Variables Practice Quiz Solution |
Question 1
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 = " + str(2 + 2))
# print("2 + 2 = {}".format(2 + 2))
# print(f"2 + 2 = {2 + 2}")
Question 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 = 47.28
tip = bill * 15/100
total = bill + tip
share = total/2
print("Each person needs to pay: " + str(share))
Each person needs to pay: 27.186
Question 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 = 10
denominator = 10
result = numerator / denominator
print(result)
1.0
Question 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(word1 + " " + word2 + " " + word3 + " " + word4 + " " + word5 + " " + word6 + " " + word7)
How do you like Python so far?
Question 5
What do you call a combination of numbers, symbols, or other values that produce a result when evaluated?
1. An explicit conversion
2. An expression
3. A variable
4. An implicit conversion
No comments:
Post a Comment