Question
In Python, there are two main rules for naming variables. The first character cannot be a number. Only letters, numbers, and the underscore character are
In Python, there are two main rules for naming variables.
The first character cannot be a number.
Only letters, numbers, and the underscore character are allowed.
Write a PYTHON program that prompts users to enter a potential variable name and tells them whether or not it is valid. Your program should consist of two functions. The first should take one argumentthe potential variable name, validate the name, and return Boolean True if it is valid or False if it is not. The second, a main()function, should get input from the user, call the validator function and print This is a valid variable name or This is not a valid variable name.
Users should repeatedly be prompted to enter another variable name until they enter done.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started