>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
160
Questions
5/8
Page
Pick an option on a question to see the right answer and solution.
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]Select an option to see the answer and solution.
print("xyyzxyzxzxyy".count('xyy', 0, 100))Select an option to see the answer and solution.
print('''
\tfoo'''.lstrip())Select an option to see the answer and solution.
print('my_string'.isidentifier())Select an option to see the answer and solution.
print("ab\tcd\tef".expandtabs())Select an option to see the answer and solution.
>>>example = "snow world"
>>>print("%s" % example[4:7])Select an option to see the answer and solution.
print("Hello {1} and {0}".format('bin', 'foo'))Select an option to see the answer and solution.
print('{:,}'.format('1112223334'))Select an option to see the answer and solution.
print('*', "abcde".center(6), '*', sep='')Select an option to see the answer and solution.
Select an option to see the answer and solution.
print('a B'.isalpha())Select an option to see the answer and solution.
Select an option to see the answer and solution.
print('abcdef12'.replace('cd', '12'))Select an option to see the answer and solution.
print('abcdefcdghcd'.split('cd', 2))Select an option to see the answer and solution.
print('Ab!2'.swapcase())Select an option to see the answer and solution.
print("abcdef".center(7, 1))Select an option to see the answer and solution.
class Name:
def __init__(self, firstName, mi, lastName):
self.firstName = firstName
self.mi = mi
self.lastName = lastName
firstName = "John"
name = Name(firstName, 'F', "Smith")
firstName = "Peter"
name.lastName = "Pan"
print(name.firstName, name.lastName)Select an option to see the answer and solution.
Select an option to see the answer and solution.
print("xyyzxyzxzxyy".endswith("xyy"))Select an option to see the answer and solution.
Q100
Open questionprint('The sum of {0} and {1} is {2}'.format(2, 10, 12))Select an option to see the answer and solution.