Alphanumeric

# Check type for alphanumeric input

s = input('Enter alphanumeric string: ')
if s.isalnum():
      print('Input is alphanumeric. ')
      print('Data type: ',type(s))
else:
      print('Input is not alphanumeric.')
print('Your input: ',s)
Output
Enter alphanumeric string: a123a
Input is alphanumeric.
Data type: str
Your input: a123a

Published by Python programming examples for beginners

Abhay Gadkari is an IT professional having around experience of 20+ years in IT industry. He worked on web technologies and databases with Insurance and ERP projects.