Comparing Strings using Python

PHOTO EMBED

Thu Oct 07 2021 17:58:04 GMT+0000 (UTC)

Saved by @Adam101 #python #print

# define strings
listOfPlaces = ["Berlin", "Paris", "Lausanne"]
currentCity = "Lausanne"

for place in listOfPlaces:
    print ("comparing %s with %s: %s" % (place, currentCity, place == currentCity))
content_copyCOPY

check in the print statement python

https://stackabuse.com/comparing-strings-using-python/