def character_element(n):
import string
if n in string.ascii_letters:
print('Letter')
elif n in string.digits:
print('Digit')
else:
print('Special Character')
The Above code have two test cases, but they were not getting any expected output even one test case also. Please give me expected output. Thank you !
Question url link :-
https://drive.google.com/file/d/1iGIZxhoPoL67KNkroEgQpaIo3Vh8w7dE/view?usp=sharing
The test cases are below
Sample Input 1
9
Sample Output 1
Digit
Sample Input 2
A
Sample Output 2
Uppercase Letter
n = input()
order = ord(n)
if order>=48 and order<=57:
print("Digit")
elif order>=65 and order<=90:
print("Uppercase Letter")
elif order>=97 and order<=122:
print("Lowercase Letter")
else:
print("Special Character")
Input 1:
9
Output 1:
Digit
Input 2:
A
Output 2:
Uppercase Letter
Input 3:
t
Output 3:
Lowercase Letter
Input 4:
@
Output 4:
Special Character
Comments
Leave a comment