# File stringDemo1.py # Author: G.Doeben-Henisch # First date: July 15, 2019 ################## # Function definition sword() def sword(w1): w=str(w1) if w.islower(): print('Is lower\n') elif w.isalpha() : print('Is alpha\n') elif w.isdecimal(): print('Is decimal\n') elif w.isascii(): print('Is ascii\n') else : print('Is not lower, alpha, decimal, ascii\n') ########################## # Main Programm ############### # Start main loop loop='Y' while loop=='Y': ################### # Ask for Options opt=input('Single word =1 or multiple words =2\n') if opt=='1': w1=input('Input a single word\n') sword(w1) # Call for new function defined above elif opt=='2': w1=input('Input multiple words\n') w2=w1.split() # Call for built-in method of class str print(w2) loop=input('To stop enter N\n') # Check whether loop shall be repeated