str1[ : : -1 ]
str1[ : : 1 ]
str1[ : -1 : -1 ]
None
What will be the output of the following Python code snippet?
print('cd'.partition('cd'))
(‘cd’)
(”)
(‘cd’, ”, ”)
(”, ‘cd’, ”)
19
18
17
Error
What will be the output of the following Python code?
print("xyyzxyzxzxyy".count('yy', 1))
2
0
1
none of the mentioned
print('abcd'.partition('cd'))
(‘ab’, ‘cd’, ”)
(‘ab’, ‘cd’)
error
x = 'abcd'for i in x: print(i) x.upper()
a B C D
a b c d
A B C D
print('xyxxyyzxxy'.lstrip('xyy'))
zxxy
xyxxyyzxxy
xyxzxxy
what will the output of following code
my_string="Hello,world"print(my_string[-6:-1])
,worl
worl
world
oworld
example = "NITIN" print(example.rfind("N"))
-1
4
3
x = "abcdef"i = "a"while i in x: x = x[:-1] print(i, end = " ")
i i i i i i
a a a a a a
a a a a a
startswith()
startswith_prefix()
startswithwith()
startswiths()
find()
copy()
upper()
capitalize()
White Space
,
e
S
anywhere in between the file
End
beginning
second line of the file
print('abcdefcdghcd'.split('cd', -1))
[‘ab’, ‘ef’, ‘gh’]
[‘ab’, ‘ef’, ‘gh’, ”]
(‘ab’, ‘ef’, ‘gh’)
(‘ab’, ‘ef’, ‘gh’, ”)
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
a a a a a a … infinite Time
a
print('a@ 1,'.islower())
True
False
string = "my name is x"for i in string: 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,
count()
strip()
उपरोकà¥à¤¤ सà¤à¥€
What does the following code print ?
x = 'mohan'for i in range (len(x)): x[i].upper()print (x)
mohan
MOHAN
None of These
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
Concatenation
Membership
Slicing
All of the above
length
length()
len()
print("xyyzxyzxzxyy".endswith("xyy"))
All the above
print s[0]
print s.lower()
s[1]='r'
print s.strip()
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘abef’)
(‘ab’, ‘cd’, ‘ef’)
print("abcdef".find("cd"))
None of the mentioned
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('ab,12'.isalnum())
print("xyyzxyzxzxyy".count('xyy', -10, -1))
print('Ab!2'.swapcase())
AB!@
ab12
aB!2
aB1@
wd[4:]
wd[:4]
wd[-5:]
wd[:-4]
example = "snow world"example[3] = 's'print (example)
snow
snow world
snos world
print('HelloWorld'.istitle())
dlroWolleH
Hello Worl
d
matches a pattern at the start of the string.
matches a pattern at any position in the string.
such a function does not exist
print('1Rn@'.lower())
n
1rn@
rn
r
print('abcdefcdgh'.partition('cd'))
(‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
(‘ab’, ‘cd’, ‘efcdgh’)
(‘abcdef’, ‘cd’, ‘gh’)
print("abcdef".find("cd") == "cd" in "abcdef")
print('abcdefcdghcd'.split('cd', 0))
[‘abcdefcdghcd’]
‘abcdefcdghcd’
print('Hello!2@#World'.istitle())
slicer
None of these-
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
>>>max("what are you")
what
y
print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
xyyxyyxyxyxxy
12y12y1212x12
print("xyyzxyzxzxyy".count('xyy', 2, 11))
print('11'.isnumeric())
x = "abcdef"i = "a"while i in x: x = x[1:] print(i, end = " ")
no output
23
'2+3'
'23'