Python Question

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

I'm solving computational thinking and Python exercises in Python books There is a problem that says, "If the user is given a quiz and contains capital letters, let's guide them to enter only lowercase letters."

a = 1
while a !='q':
    a = input ("Question. Discord in English? :")
    if a == ''discord"
        print ("Correct")
    else :
        print ("Wrong Answer")

After writing like this, I think I need to use a.islower() but I don't know what to do


2022-09-20 10:51

1 Answers

str = 'Hell?O'
str2 = 'hell?o'

print(str.islower()) # False
print(str2.islower()) # True

if (str2.islower()):
    print('It is lowercase') # 'It is lowercase'

2022-09-20 10:51

If you have any answers or tips

© 2022 pinfo. All rights reserved.