Write codes that ask the user to write the name in lowercase. If they did not write in lowercase, keep asking them to re-enter the name until they write in lowercase. If they followed as instructed, then print the statement “Entered name is in lowercase”
isLowercase=False
while isLowercase==False:
#ask the user to write the name in lowercase.
name = input("Enter the name in lowercase: ")
lowercaseLetters = ''.join(c for c in name if c.islower())
isLowercase=(len(name)==len(lowercaseLetters))
#If they did not write in lowercase, keep asking them to re-enter the
#name until they write in lowercase.
if isLowercase==False:
print("Entered name is not in lowercase. Re-enter the name.")
#print the statement “Entered name is in lowercase”
print("Entered name is in lowercase")
Comments
Leave a comment