100%.
How would you display the message "Hello" on the console. correct answers print("Hello")
How would you assign the product of hourlySalary and hoursWorked to variable
earnings. correct answers earnings = hourlySalary*hoursWorked
Determine the output produced by the lines of code.
1). 1 num = 4
2). if num <= 9:
3). print("Less than ten.")
4). else:
5). if num == 4:
6). print("Equal to four.") correct answers # Less than ten.
Determine the output produced by the lines of code.
1). price = 0
2). age = 17
3).
4). if (age < 6):
5). price = 0
6). elif (age <= 17):
7). price = 3.75
8). else:
9). price = 5
10
11). print("The price is ", format(price, "0.2f")) correct answers # The price is 3.75.
Identify the error
Print(Hello) correct answers print("Hello")
Identify the error
a=2
b=3
a+b=c
print(c) correct answers c = a + b
Identify the error
0.05 = interest
balance = 800*interest correct answers interest = 0.05
Write a condition equivalent to the negation of the given condition.
(a == b) correct answers (a != b)
, Write a condition equivalent to the negation of the given condition.
(a < b) correct answers (a >= b)
Write a condition equivalent to the negation of the given condition.
(c != d) correct answers (c == d)
What does this code do?
number1, number2, result = 0, 0, 0
number1 = 5*(4+6)
number2 = 2^2
result = number1\number2 correct answers number1 = 50
number2 = 4
result = 12
Improve/Simplify the code.
1).if (j == 7):
b=1
else:
if (j != 7) :
b = 2 correct answers if (j == 7):
b=1
else:
b=2
Improve/Simplify the code.
if not (answer !="y"):
print("Yes")
else:
if (answer == "y") or (answer == "Y"):
print("Yes") correct answers if (answer == "Y" or answer == "y")
print("Yes")
Declare variables used in steps b) - d), and initialize them to 0. correct answers price,
discountPercent, markDown = 0, 0, 0
Assign the value 19.95 to the variable price. correct answers price = 19.95
Assign the value 30 to the variable discountPercent. correct answers discountPercent = 30
Assign the value of (discountPercent divided by 100) times
price to the variable markDown. correct answers markDown = prince*discountPercent/100
Decrease price by markdown. correct answers price = price - markDown
print the value of price on the console and format it with two decimal points. correct answers
print("The price is", format(price, "0.2f"))