Practice problems on string (ds310323) #others can also try!

1---->Select the correct output of the following String operations

str = “my name is James bond”;
print (str.capitalize())

a)My Name Is James Bond

b)TypeError: unsupported operand type(s) for * or pow(): 'str' and 'int'

c)My name is James bond

2----> Select the correct output of the following String operations

str1 = “my isname isisis jameis isis bond”;
sub = “is”;
print(str1.count(sub, 4))

a)5

b)6

c)7

3 Likes

@udk.amazon
ANS1-a)My Name Is James Bond
ANS2-b)6

1 Like

@udk.amazon sir,
1---------> c) My name is James bond
2---------> b) 6

1 Like

Answers:

  1. My name is James bond
  2. 6
  1. (A)
  2. (B)

Suggestion :----------->>>> Please Do not copy paste quiz from webservers

1 Like