Quiz
A string is assigned to a variable
a = 'Amazing'
Which expressions will let you print the second character 'm' of this String
A string is assigned to a variable
a = 'Amazing'
Which expression will get you the characters from position 0 to index of 'z', including 'z'
A string is assigned to a variable
a = 'Amazing'
You wrote an expression to find if the given string has a substring 'zing'
a.find('zing')
This expression returns the -
A string is assigned to a variable
a = 'amazing'
You wrote an expression to capitalize this string
a.capitalize()
print(a)
This will print -
A string is assigned to a variable
a = 'amazing'
You wrote an expression to find its length
print(len(a))
This will print -
What is the result of evaluating this expression
'amazing'.count('a', 1)
What is the result of evaluating this expression
'amazing'.count('a', 0, 2)
Study the code below
pi = 3.141592653589793
b = '{:.3f}'.format(pi)
print(b)
What is the output of the print statement?
Study the code below
pi = 3.141592653589793
b = '{:.3f}'.format(pi)
print(type(b))
What is the data type of 'b'?
Study the code below
t1 = (5, 8)
t2 = (10,15)
d = 'X: {0[0]}; Y: {1[1]}'
d.format(t1, t2)
What is the output?
What is output of the given expression?
a=3.14159
{:.0f}.format(a)
What is output of the given expression?
'{1:}{0}'.format('B', 10)