First letter after digit X54444


Statement
 

pdf   zip

html

Write a function let_after_digit(s) that given a string s returns a boolean and a character. The boolean is True when s has some letter after some digit, otherwise is False. The character has to be the first letter in s that comes out after some digit in the first case and the symbol ’#’ in the second one. You can use the string method isalpha() to check whether given a string it has at least one character and all its characters are letters. For instance, my_string.isalpha() is True when my_string is ’HeLLo’ or ’X’ and is False when my_string is ’He7TO’ or ’?;x’ or ’123456’.

Sample session
>>> let_after_digit('Game Over')
(False, '#')
>>> let_after_digit('Error 324:---Identifier not defined---')
(True, 'I')
>>> let_after_digit('xRs123')
(False, '#')
>>> let_after_digit('1@#$X2Y')
(True, 'X')
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python