Robotics & Artificial Intelligence
What would be the output of following code?
information = "I am studying in class X !"
val = information.find("studying")
print("The index is: ", val)
- 5
- 6
- 7
- Error
Python String Manipulation
2 Likes
Answer
5
Reason — The find() function returns the index of the first occurrence of the specified value. In the given string, the word "studying" starts at index 5, therefore the output is 5.
Answered By
3 Likes
Related Questions
What would be the output of following code?
Q1 = "Hello How are you" val = Q1.count("H") print(val)- 1
- 3
- 2
- Error
The method used to check that all characters in a string are alpha numeric is …………… .
- isal()
- isalnum()
- isnum()
- isalphanum()
Fill in the blanks:
- """Hello How are you?
I am good.""" is an example of ……………. . - The ……………. operator returns true if a character does not belong to a string.
- In Python ……………. is used to introduce a new line.
- The ……………. function takes an iterator as an input of argument.
- The isdigit() function returns ……………. if all the elements in the string are digits.
- """Hello How are you?
Write a Python program to convert all the letters of a string in uppercase.