Usernames An online company needs your help to implement a program that verifies the username chosen by a new user. Their rules is described below: Username MUST contain at least 6 characters; Username cannot start with a number; Username can only contain letters or numbers. If valid, the username may be resgistered if it doesn't already exist in the system. You should not use built-in functions to determine the character type such as isnumeric() or islower(). Use the strings given alphabet and numeric to determine if each character is valid. Use the list registered to help you determine if the username is already registered. Don't forget to execute the cell below to use these strings # run this cell to create these variables alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' numeric = "0123456789" registered = ["john87", "topmage", "light4ever", "username2"]   Write a function nameValidation which receives a String argument name. This function: has name String argument: the name for the tag return True if the name is valid, or False otherwise Other notes: This function is not case sensititve. This means either lowercase or uppercase characters are valid; you should not use a String built-in function to help you with this. You should use the "flag technique" to implement this function. Document your code using comments. Write at least 3 test cases to demonstrate your function's expected behaviour.       [ ]:           # Your solutiondef nameValidation             [ ]:             # Test cases print(nameValidation("ARYA STARK")) # expected output False print(nameValidation("JIMSMITH")) # expected output True print(nameValidation("k8")) # expected output False print(nameValidation("Leah1")) # expected output False print(nameValidation("1friend")) # expected output False print(nameValidation("Galadr1EL")) # expected output True   ​# Your test cases

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Usernames

An online company needs your help to implement a program that verifies the username chosen by a new user. Their rules is described below:

  1. Username MUST contain at least 6 characters;
  2. Username cannot start with a number;
  3. Username can only contain letters or numbers.

If valid, the username may be resgistered if it doesn't already exist in the system.

  • You should not use built-in functions to determine the character type such as isnumeric() or islower().
    • Use the strings given alphabet and numeric to determine if each character is valid.
  • Use the list registered to help you determine if the username is already registered.

Don't forget to execute the cell below to use these strings

# run this cell to create these variables
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
numeric = "0123456789"
registered = ["john87", "topmage", "light4ever", "username2"]

 

Write a function nameValidation which receives a String argument name. This function:

  • has name String argument: the name for the tag
  • return True if the name is valid, or False otherwise

Other notes:

  • This function is not case sensititve. This means either lowercase or uppercase characters are valid; you should not use a String built-in function to help you with this.
  • You should use the "flag technique" to implement this function.
  • Document your code using comments.
  • Write at least 3 test cases to demonstrate your function's expected behaviour.
 
 
 
[ ]:
 
 
 
 
 
# Your solutiondef nameValidation
 
 
 
 
 
 
[ ]:
 
 
 
 
 
 
# Test cases
print(nameValidation("ARYA STARK")) # expected output False
print(nameValidation("JIMSMITH")) # expected output True
print(nameValidation("k8")) # expected output False
print(nameValidation("Leah1")) # expected output False
print(nameValidation("1friend")) # expected output False
print(nameValidation("Galadr1EL")) # expected output True
 
​# Your test cases
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education