What will be the output of the following Python code?
print('a'.maketrans('ABC', '123'))
{97: 49, 98: 50, 99: 51}
{65: 49, 66: 50, 67: 51}
{97: 49}
1
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘abef’)
(‘ab’, ‘cd’, ‘ef’)
2
print('abcdefcdgh'.partition('cd'))
(‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
(‘ab’, ‘cd’, ‘efcdgh’)
(‘abcdef’, ‘cd’, ‘gh’)
error
What will be the output of the following Python code snippet?
print('cd'.partition('cd'))
(‘cd’)
(”)
(‘cd’, ”, ”)
(”, ‘cd’, ”)
print('abef'.partition('cd'))
(‘abef’, ‘cd’, ”)
(‘abef’, ”, ”)
print('abcdef12'.replace('cd', '12'))
ab12ef12
abcdef12
ab12efcd
none of the mentioned
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
xyyxyyxyxyxxy
12y12y1212x12
print('abcdefcdghcd'.split('cd'))
[‘ab’, ‘ef’, ‘gh’]
[‘ab’, ‘ef’, ‘gh’, ”]
(‘ab’, ‘ef’, ‘gh’)
(‘ab’, ‘ef’, ‘gh’, ”)
print('abcdefcdghcd'.split('cd', 0))
[‘abcdefcdghcd’]
‘abcdefcdghcd’
print('abcdefcdghcd'.split('cd', -1))
print('abcdefcdghcd'.split('cd', 2))
[‘ab’, ‘ef’, ‘ghcd’]
[‘ab’, ‘efcdghcd’]
[‘abcdef’, ‘ghcd’]
print('ab\ncd\nef'.splitlines())
[‘ab’, ‘cd’, ‘ef’]
[‘ab ’, ‘cd ’, ‘ef ’]
[‘ab ’, ‘cd ’, ‘ef’]
[‘ab’, ‘cd’, ‘ef ’]
print('Ab!2'.swapcase())
AB!@
ab12
aB!2
aB1@
print('ab cd ef'.title())
Ab cd ef
Ab cd eF
Ab Cd Ef
None of the mentioned
print('ab cd-ef'.title())
Ab cd-ef
Ab Cd-ef
Ab Cd-Ef
print('abcd'.translate('a'.maketrans('abc', 'bcd')))
bcde
abcd
bcdd
print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
1234
00+99
00099
+0099
+++99
seed()
sqrt()
factorial()
print()