Password Validator
Password validator is a program that validates passwords to match specific rules. For example, the minimum length of the password must be eight characters long and it should have at least one uppercase letter in it.
A valid password is the one that conforms to the following rules:
- Minimum length is 5;
- Maximum length is 10;
- Should contain at least one number;
- Should contain at least one special character (such as &, +, @, $, #, %, etc.);
- Should not contain spaces.
- Minimum length is 5;
- Maximum length is 10;
- Should contain at least one number;
- Should contain at least one special character (such as &, +, @, $, #, %, etc.);
- Should not contain spaces.
Examples:
Input: "Sololearn"
Output: false
Input: "Sololearn"
Output: false
Input: "John Doe"
Output: false
Output: false
Input: "$ololearn7"
Output: true
Output: true
Write a program to checks if the user input is a valid password or not.
Caesar Cipher
The Caesar cipher is a type of substitution cipher in which each letter in the plaintext is shifted to a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who allegedly used it to communicate with his generals.
For example:
Input: "defend the east wall of the castle"
Output: "efgfoe uif fbtu xbmm pg uif dbtumf"
Input: "defend the east wall of the castle"
Output: "efgfoe uif fbtu xbmm pg uif dbtumf"
Write a program that encrypts the user input using the Caesar cipher.
Emirp mumbers
An emirp is a prime number that results in a different prime when its decimal digits are reversed. For example, 13 is an emirp number because both 13 and 31 are prime numbers.
For example:
Input: 17
Output: true (17 and 71 are prime numbers)
Input: 17
Output: true (17 and 71 are prime numbers)
Input: 113
Output: true (113 and 311 are prime numbers)
Output: true (113 and 311 are prime numbers)
Input: 23
Output: false (23 is a prime number, but 32 is not)
Output: false (23 is a prime number, but 32 is not)
Write a program to check if the user input is an emirp number or not.
Find The First Recurring Character
Write a program that takes a string asinput and returns the first recurring character as the output.
For example:
Input: "ABCA"
Output: A
Input: "ABCA"
Output: A
Input: "BCABA"
Output: B
Output: B
Input: "ABC"
Output: None
Output: None
Comments
Post a Comment