code:
city=['Shenzhen','Shanghai','Beijing','Hangzhou']
address='My family lives in Hangzhou, China'
if any(element in address for element in city):
print("The string "%s" contains the string "%address" in the city)
output:
code:
city=['Shenzhen','Shanghai','Beijing','Hangzhou']
address='My family lives in Hangzhou, China'
if any(element in address for element in city):
print("The string "%s" contains the string "%address" in the city)
output: