0% found this document useful (0 votes)
21 views1 page

EXPERIMENT11

The document outlines an experiment aimed at creating a program to check for the presence of a substring in a list of strings. It includes source code that performs this check and prints whether the substring is present in each string. The conclusion states that the experiment was successful in achieving its objective.

Uploaded by

Ayush Gautam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

EXPERIMENT11

The document outlines an experiment aimed at creating a program to check for the presence of a substring in a list of strings. It includes source code that performs this check and prints whether the substring is present in each string. The conclusion states that the experiment was successful in achieving its objective.

Uploaded by

Ayush Gautam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EXPERIMENT-11

Objective: To make a program to check if a substring is present in each string or not.

Source code:
string_list=["hello world","python programming","world of code","hello"]
substring="hello"
substring_present=[substring in string for string in string_list]
for i, string in enumerate(string_list):
if substring_present[i]:
print(f"substring '{substring}' is present in:'{string}'")
else:
print(f"substring '{substring}' is not present in: '{string}'")

Input and output:

Conclusion: This experiment successfully created a program that checks if a given substring
is present in each string of a provided string list.

You might also like