Open main menu

CDOT Wiki β

Changes

OPS445 Online Lab4

2 bytes added, 01:47, 2 February 2022
m
PART 2 - Searching and Validating
if __name__ == '__main__':
s1 = 'Seneca'
print(s1,'contains letter s? ->',find(s1,'s')) print(s1,'contains letter S? ->',find(s1,'S'))
</source> The find() function defined above, is not needed, as it can be replaced by the python keyword '''in''', which can be used as a boolean operator. This boolean operator takes two strings, and return '''True''' if the first appears as a substring in the second.<br/>
572
edits