Skip to content

Instantly share code, notes, and snippets.

@kneerunjun
Last active December 27, 2016 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kneerunjun/7b0a7b35c89d66a24992b6a375eda6ea to your computer and use it in GitHub Desktop.
Save kneerunjun/7b0a7b35c89d66a24992b6a375eda6ea to your computer and use it in GitHub Desktop.

Problem description: 

  1. Create an application which requires the users to input username and password to register.
  2. Write a program to check the validity of password input by users.

Following are the criteria for checking the password:

  1. At least 1 letter between [a-z]
  2. At least 1 number between [0-9]
  3. At least 1 letter between [A-Z]
  4. At least 1 character from [$#@]
  5. Minimum length of transaction password: 6
  6. Maximum length of transaction password: 12

Your program should accept a sequence of comma separated passwords and will check them according to the above criteria. Passwords that match the criteria are to be printed, each separated by a comma.

Example

If the following passwords are given as input to the program: ABd1234@1,a F1#, 2w3E*, 2We3345

Then, the output of the program should be: ABd1234@1

Hints:

  1. In case of input data being supplied to the question, it should be assumed to be a console input. 2. Assuming that we have some email addresses in the "username@companyname.com" format, please write program to print the user name of a given email address. Both user names and company names are composed of letters only.

Example: If the following email address is given as input to the program:

mickey@infosys.com

Then, the output of the program should be:

Mickey

In case of input data being supplied to the question, it should be assumed to be a console input.

3. Write a script which accepts a sequence of words separated by whitespace as input to print the words composed of digits only.

Example: If the following words is given as input to the program:

1, KitKat, 5, Milkybar, 7, fivestar 

Then, the output of the program should be:

['1', '5', '7']

In case of input data being supplied to the question, it should be assumed to be a console input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment