NEW
Font size
WorksheetsStrings in python
Total questions: 10
Worksheet time: 8mins
What is printed by the following statement?
print("P" not in "APCSP")
True
False
Error
Evaluate the following expression:
"dog" < "Dog"
They are the same word
True
False
For strings, the + operator represents
Concatenation
Addition
Appending
Recantation
s1="Hello"
n1=10
print(s1+n1)
What is the error in this code?
Print statement not written in quotes
Numeric value not written in quotes
colon not written after the print statement
string cannot be added to a number
str1='101'
x=int(str1)
z=x+400
print(z)
101400
x400
501
none of above
index of a string begins with
1
0
a
-1
________ is used to represent multi line strings.
' '
" "
''' '''
{ }
What will the output be from the following code?
X = "Hello World"
for i in X[0:2]:
print("Bye")
Bye
Bye
Hello World Bye
Bye He
He
Bye
word = "amazing"
For the given string if we run word[2:5] , what would the result be?
mazi
mazin
azi
azin
Which method is used to convert a given string in Capital letters?
capital
upper
ConverttoUpper
capitalize
