Python Strings Quiz

Python Strings Quiz

1) What is the output of the following code?
str = "Python"
print(str[4])

2) What is the output of the following code?
str = "Python"
print(str[6])

3) What is the output of the following code?
str = "Python"
print(str[-3:-5:-2])

4) What is the output of the following code?
print("222".islower())

5) What is the output of the following code?
print("222r".islower())

6) What is the output of the following code?
str = "Python"
print(type(str[4]))

7) What is the output of the following code?
str = "Python"
print(type(str))

8) Find the illegal string operation.

9) How to find the total number of characters in the string?

10) Which function can replace every 'j' with a 'k'?

11) Which function can be used to convert a string to a list?

12) How can we split the string into the tuple of 3 elements?

13) What can be used to find the last 4 characters of the string?

14) What is the output of the following code?

my_string = "Logical 10"
my_string2 = "1010"
print(my_string.isdigit(), my_string2.isdigit())

15) What is the output of the following code?

str = "i am Best 1010."
print(str.capitalize())

16) What is the output of the following code?

a = ''
a.isalnum()

17) How to get character from ASCII?

18) How to get ASCII from a character?

19) What is the output of the following code?

my_string = "Logical Python is the Best. 100%"
print(my_string.title())

20) How to remove leading and trailing spaces from a string?

Your score is

The average score is 63%

0%