Write a python program that will take a String as input from the user. It will print “Found”, if 4 consecutive lowercase letters are found, otherwise “Not Found”.
[You cannot use any built in function except input(), print(), len(String), ord(String), chr(int).] Sample input 1: aFrese111 Sample output 1: Found
In the following script, it has been taken into account that the "ord" built-in function returns a value between 97(a) and 122(z) for lower-case letters:
def foundOrNot (string):
consecutiveLower = 0
for i in (string):
unicodeNumber = ord(i)
if consecutiveLower == 4:
break
elif (unicodeNumber >= 97 and unicodeNumber <= 122):
consecutiveLower += 1
else:
consecutiveLower = 0
if (consecutiveLower == 4):
print ("Found")
else:
print ("Not found")
testString = input()
foundOrNot(testString)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments