Computer Science, asked by neha415288, 8 months ago

Consider the string str="Green Revolution".write statements in python to implement the following:
To display the last four characters.
To display the starting index for the substring 'vo.'
To check whether the string contains 'vol' or not
To repeat the string 3times​

Answers

Answered by valeriy69
31

string = "Green Revolution"

# last 4 chars

string_len = len(string)

last_chars = string[string_len - 4:]

print(f"last 4 chars: {last_chars}")

# starting index of substring "vo"

idx = string.index("vo")

print(f"vo index: {idx}")

# check if "vol" in string

if "vol" in string:

print("vol in string")

else:

print("vol not in string")

# repeat string 3 times

print(string * 3)

\small\mathsf\color{lightgreen}useful?\: \color{white}\mapsto\: \color{orange}brainliest

Similar questions