Answer to Question #223944 in Python for Hari nadh babu

Question #223944
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


1
Expert's answer
2021-08-09T02:21:38-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS