Another way. Modified code a little.
#! /usr/bin/env python3.8 while True: try: my_name = input('What is your name: ') if my_name.isdigit(): print(f'{my_name} is a number. Please use letters for a name.') continue else: print(f'Your name is {my_name}. It\'s nice to meet you') print(f'The length of your name is {len(my_name)} letters.') break except ValueError as error: print(f'Error: {error}') break while True: try: my_age = input(f'{my_name.title()}, what is your age: ') if my_age.isalpha(): print(f'{my_age} is not allowed in age') continue else: age = int(my_age) + 1 print(f'{my_name.title()} will be {age} next year.') break except ValueError as error: print(f'Error: {error}') break
Output:What is your name: john
Your name is john. It's nice to meet you
The length of your name is 4 letters.
John, what is your age: p
p is not allowed in age
John is your age: 15
John will be 16 next year.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags