To print "BBBBB" given that the variable letter
is assigned the value "B", the correct line of code would be:
print(letter * 5)
This line of code takes the value of letter
, which is "B", and repeats it 5 times, resulting in "BBBBB".
The other options do not correctly print "BBBBB":
print(letter)
will print "B".print5("letter")
is not valid syntax because there is no functionprint5
.print("letter" * 5)
will print "letterletterletterletterletter", as it repeats the string "letter" instead of the value of the variableletter
.
So, the correct answer is:
print(letter * 5)