Question
How many parameters are you passing into the print() function in the following statement?
print("My final answer is: " + str(answer) )
Select one:
a.
1
b.
2
c.
3
d.
0
print("My final answer is: " + str(answer) )
Select one:
a.
1
b.
2
c.
3
d.
0
Answers
Answer
What happens when you call print() and provide more than one parameter, separated by commas?
Select one:
a.
print() will only display the first parameter and ignore the rest
b.
print() will only display the last parameter and ignore the rest
c.
You will get an error message when you run the program
d.
print() will automatically concatenate them together into a single output string
Select one:
a.
print() will only display the first parameter and ignore the rest
b.
print() will only display the last parameter and ignore the rest
c.
You will get an error message when you run the program
d.
print() will automatically concatenate them together into a single output string
Answer
What is the displayed output when the following code is run?
myGPA = 3.5
print("My GPA is", str(myGPA))
Select one:
a.
My GPA is3.5
b.
3.5
c.
My GPA is
d.
My GPA is 3.5
myGPA = 3.5
print("My GPA is", str(myGPA))
Select one:
a.
My GPA is3.5
b.
3.5
c.
My GPA is
d.
My GPA is 3.5
Answer
What is the displayed output when the following statement is run?
print("phone","number",sep="#")
Select one:
a.
"phone" on one line and "number" on the next
b.
phonenumber
c.
phone number
d.
phone#number
print("phone","number",sep="#")
Select one:
a.
"phone" on one line and "number" on the next
b.
phonenumber
c.
phone number
d.
phone#number
Answer
Which of the following statements will print a message and NOT automatically advance to the next line for the next printed output?
Select one:
a.
This is not possible with the print() function
b.
print("Stay here", sep=" ")
c.
print("Stay here", end=" ")
d.
print("Stay here")
Select one:
a.
This is not possible with the print() function
b.
print("Stay here", sep=" ")
c.
print("Stay here", end=" ")
d.
print("Stay here")
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.