19 solutions available
Question 3Assertion (A): The process of repeating a set of elements in a string is termed as replication.Reasoning (R): Repetition allows us to...
Question 12What will be the output of the following code?A = 'Virtual Reality' A.replace('Virtual', 'Augmented') Virtual AugmentedReality...
Question 13What will be the output of the following?print("ComputerScience".split("er", 2))["Computer", "Science"]["Comput", "Science"]["Comput",...
Question 15STR = "RGBCOLOR" colors = list(STR)How do we delete 'B' in given List colors?del colors[2]colors.remove("B")colors.pop(2)All of these
Question 1How does '*' operator behave on strings?
Question 2Explain function split() with an example.
Question 4Write the output of the following:>>> x = "hello" >>> print(x[1:-2])
Question 5(a)Write the output of the following:string = "Hello Madam, I love Tutorials" substring = "Madam" if string.find(substring) != -1:...
Question 5(b)Write the output of the following:s = "Strings in Python" print(s.capitalize()) print(s.title()) s6 = s.replace("in", "data type")...
Question 6Find the output of the following:word = 'work hard' result = word.find('work') print("Substring, 'work', found at index:", result) result =...
Question 7Consider the following string mySubject:mySubject = "Computer Science"What will be the output of the following string operations?(i) print...
Question 8Write the Python statement and the output for the following:(a) Find the third occurrence of 'e' in 'sequence'.(b) Change the case of each...
Question 9Consider the string str1 = "Global Warming".Write statements in Python to implement the following:(a) To display the last four...
Question 10What will be the output of the following code?Text = "Mind@Work!" ln = len(Text) nText = "" for i in range(0, ln): if...
Question 13Write a program that takes a sentence as an input parameter where each word in the sentence is separated by a space. The function should...
Question 15What will be the output of the following programming code?str = "My Python Programming" print (str[-5:-1]) print (str[1:5]) print...
Question 16Write a program to count the number of each vowel in a given string.Solutioninput_string = input("Enter a string: ") vowel_count = {'a':...
Question 17Write a program that reads a line, then counts how many times the word 'is' appears in the line and displays the count.Solutionline =...
Question 18Write a program to remove 'i' (if any) from a string.Solutioninput_string = input("Enter a string: ") result_string =...