I have a doubt in coding | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I have a doubt in coding

coding to find entered value is uppercase or lower case

23rd Jul 2016, 1:07 PM
Mayil esh
Mayil esh - avatar
9 Answers
+ 1
To check if string is in uppercase, use the string method isupper () To check if it is lowercase, use islower () E.g. s = input () if s.islower (): print ("The input is in lowercase") elif s.isupper (): print ("The input is in uppercase") else: print ("The input is in mixed case")
23rd Jul 2016, 2:34 PM
Gershon Fosu
Gershon Fosu - avatar
0
it's input. x = input(" ") print(x)
23rd Jul 2016, 1:23 PM
Abel Fernando Barros Rodrigues
Abel Fernando Barros Rodrigues - avatar
0
x=input(" ") print(x) it is fine but you will reveal the answer alone but I need to print the entered char is uppercase or lowercase for ex if you entered A means print upper case a means lowercase
23rd Jul 2016, 1:29 PM
Mayil esh
Mayil esh - avatar
0
If I understand you correctly, use "in".
23rd Jul 2016, 1:32 PM
Alexander T.
Alexander T. - avatar
0
If I understand you correctly, use "in".
23rd Jul 2016, 1:32 PM
Alexander T.
Alexander T. - avatar
0
can you make code for it
23rd Jul 2016, 1:36 PM
Mayil esh
Mayil esh - avatar
0
If I understand you correctly, you can't actually tell if one inputs uppercase or lowercase. But you can convert the user entered value to either uppercase or lower case to suit your needs. Example: your_name = input ("enter your name: ") your_name = your_name.lower() print(your_name) your_name = your_name.upper() print(your_name)
23rd Jul 2016, 2:21 PM
Benneth Yankey
Benneth Yankey - avatar
0
it shows error it needs any module
23rd Jul 2016, 4:07 PM
Mayil esh
Mayil esh - avatar
0
islower(), isupper() sorry typo in the example corrected now
23rd Jul 2016, 4:16 PM
Gershon Fosu
Gershon Fosu - avatar