What will be the output of the following Python code?
example = "snow world"example[3] = 's'print (example)
snow
snow world
Error
snos world
matches a pattern at the start of the string.
matches a pattern at any position in the string.
such a function does not exist
none of the mentioned.
What will be the output of the following Python code snippet?
print('abcdef12'.replace('cd', '12'))
ab12ef12
abcdef12
ab12efcd
none of the mentioned
print('xyxxyyzxxy'.lstrip('xyy'))
zxxy
xyxxyyzxxy
xyxzxxy
print("xyyzxyzxzxyy".endswith("xyy"))
1
True
3
2
dlroWolleH
Hello Worl
d
print s[0]
print s.lower()
s[1]='r'
print s.strip()
startswith()
startswith_prefix()
startswithwith()
startswiths()
find()
copy()
upper()
capitalize()
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
print("xyyzxyzxzxyy".count('xyy', 2, 11))
0
error
delete all the trailing whitespace characters
delete all the leading whitespace characters
delete all the leading and trailing whitespace characters
delete upper case characters
print('abc'.islower())
False
None
count()
strip()
उपरोकà¥à¤¤ सà¤à¥€
print('abcd'.partition('cd'))
(‘ab’, ‘cd’, ”)
(‘ab’, ‘cd’)
print('abcdefcdgh'.partition('cd'))
(‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
(‘ab’, ‘cd’, ‘efcdgh’)
(‘abcdef’, ‘cd’, ‘gh’)
slicer
Slicing
Membership
None of these-
print('abef'.partition('cd'))
(‘abef’)
(‘abef’, ‘cd’, ”)
(‘abef’, ”, ”)
print('ab cd ef'.title())
Ab cd ef
Ab cd eF
Ab Cd Ef
None of the mentioned
string = "my name is x"for i in string.split(): print (i, end=", ")
m, y, , n, a, m, e, , i, s, , x,
m, y, , n, a, m, e, , i, s, , x
my, name, is, x,
print('ab,12'.isalnum())
print("abcdef".find("cd"))
List
Tuple
Dictionary
print('abcdefcdghcd'.split('cd', -1))
[‘ab’, ‘ef’, ‘gh’]
[‘ab’, ‘ef’, ‘gh’, ”]
(‘ab’, ‘ef’, ‘gh’)
(‘ab’, ‘ef’, ‘gh’, ”)
a = [0, 1, 2, 3]for a[0] in a: print(a[0])
0 1 2 3
0 1 2 2
3 3 3 3
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘ab’, ‘cd’, ‘ef’)
wd[4:]
wd[:4]
wd[-5:]
wd[:-4]
print('1.1'.isnumeric())
print("xyyzxyzxzxyy".count('xyy', -10, -1))
print('cd'.partition('cd'))
(‘cd’)
(”)
(‘cd’, ”, ”)
(”, ‘cd’, ”)
example = "NITIN" print(example.rfind("N"))
-1
4
23
'2+3'
'23'
None of These
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
print(max("what are you"))
u
t
y
print('a@ 1,'.islower())
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
x = "abcdef"i = "a"while i in x: x = x[1:] print(i, end = " ")
a a a a a a
a
no output
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
a a a a a
a a a a a a … infinite Time
print('ab'.isalpha())
White Space
,
e
S
anywhere in between the file
End
beginning
second line of the file
print('abcdefcdghcd'.split('cd', 2))
[‘ab’, ‘ef’, ‘ghcd’]
[‘ab’, ‘efcdghcd’]
[‘abcdef’, ‘ghcd’]
print('11'.isnumeric())
print("xyyzxyzxzxyy".count('yy', 1))
print('abef'.replace('cd', '12'))
abef
12
Removes all spaces from the string.
Removes the first and last character of the string.
Removes whitespace from the beginning and end of the string.
Converts the string into a list of characters.
str1="helloworld"print(str1[::-1])
dlrowolleh
hello
world
helloworld
islower()
isupper()
Islower()
print('abcdefcdghcd'.split('cd', 0))
[‘abcdefcdghcd’]
‘abcdefcdghcd’