Question

Which of the following statements will correctly assign the value "Yes, Please" to a variable named "more"?

Select one:

a.
more("Yes, Please")


b.
more = "Yes, Please"


c.
more: Yes, Please


d.
Yes, Please = more

Answers

Answer
Which of the following statements will correctly combine the string values "baa" and "sheep" into a variable called "animal"?

Select one:

a.
"baa + sheep" = animal


b.
animal = baa.sheep


c.
animal = "baa" + "sheep"


d.
animal("baa"+"sheep")
Answer
What is wrong with the following code?

result = 10 * 10
print("The answer is " + result)

Select one:

a.
Error - the mathematical operation 10 * 10 is invalid


b.
Error - the "+" symbol has no meaning for strings


c.
Error - Python can't convert the integer result to a string automatically when concatenating


d.
Nothing is wrong; this code will run without errors
Answer
What is the printed output from the following statement?

print("Testing" + "Testing")

Select one:

a.
Testing Testing


b.
class 'str'


c.
An error message


d.
TestingTesting
Answer
Which symbol is used to combine (concatenate) two strings together into a single value?

Select one:

a.
= (equals sign)


b.
. (dot)


c.
+ (plus sign)


d.
* (asterisk)
Answered by GPT 3.5
b. more = "Yes, Please"
Answered by GPT 3.5
c. animal = "baa" + "sheep"
Answered by GPT 3.5
c. Error - Python can't convert the integer result to a string automatically when concatenating
Answered by GPT 3.5
d. TestingTesting
Answered by GPT 3.5
c. + (plus sign)

Related Questions