Question

I'm trying to make a password checker in python. Is there a way of preventing a...

I'm trying to make a password checker in python. Is there a way of preventing a user from entering 2 consecutive lower case characters without using regex? Thanks

Homework Answers

Answer #1

def detectConsecutiveLowerCase(s):

        if not s or s == '':
                return False

        # this keeps the status of last character
        prevLower = s[0].islower()

        for i in range(1, len(s)):
                # if current as well as previous character was
                # lowercase
                if s[i].islower() and prevLower:
                        return True
                
                # update the status to current character's
                prevLower = s[i].islower()

        # if we reached here, then no consecutive lowercase 
        # existed
        return False

print(detectConsecutiveLowerCase('ThiWiLlBeCaUgHt'))

print(detectConsecutiveLowerCase('tHiSWiLlNOTBeCaUgHt'))
**************************************************

Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.

Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I'm trying to make a password checker in python. Is there a way of preventing a...
I'm trying to make a password checker in python. Is there a way of preventing a user from entering 2 consecutive lower case characters without using regex? Would prefer the program to take input from the user. Thanks
USING PYTHON do all the he problems using while loop , continue and break 1-This problem...
USING PYTHON do all the he problems using while loop , continue and break 1-This problem provides practice using a while True loop.write a function named twoWords that gets and returns two words from a user. The first word is of a specified length, and the second word begins with a specified letter.The function twoWords takes two parameters: an integer, length, that is the length of the first word and a character, firstLetter, that is the first letter of the...
I'm trying to write a nested loop in Mips Assembly that prints out, for example, if...
I'm trying to write a nested loop in Mips Assembly that prints out, for example, if user input x was 5: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 (spaces in between) So far my code is : li $v0, 5   #Ask for integer syscall move $t5, $v0 addi $t0, $zero, 0 For1:    slt $t1, $t0, $t5    beq $t1, $zero, Exit    add $s0, $s0, $t0    addi $t0, $t0, 1...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all user information from a given input file. The input file contains information of a user in following order: username, first name, last name, password, account number and account balance. Information is separated with ‘|’. o username is a unique information, so no two users will have same username. Sample input file: Username eaglebank has password 123456, account number of BB12 and balance of $1000....
For this assignment, you need to submit a Python program that gathers the following employee information...
For this assignment, you need to submit a Python program that gathers the following employee information according to the rules provided: Employee ID (this is required, and must be a number that is 7 or less digits long) Employee Name (this is required, and must be comprised of primarily upper and lower case letters. Spaces, the ' and - character are all allowed as well. Employee Email Address (this is required, and must be comprised of primarily of alphanumeric characters....
I'm trying to make a two box plots side by side on the SAME graph in...
I'm trying to make a two box plots side by side on the SAME graph in R, to show case the following: Treatment Distance 1 Control 50.0 2 Control 60.5 3 Control 63.5 4 Control 77.5 5 Control 51.5 6 Control 39.0 7 Control 80.0 8 Control 57.0 9 Control 55.0 10 Control 41.0 11 Control 18.0 12 Control 95.0 13 Control 52.0 14 Control 63.5 15 Control 58.0 16 Control 128.0 17 Control 106.5 18 Control 83.1 19 Control...
IN PYTHON Stretch Remember that while it’s a good idea to have one person primarily responsible...
IN PYTHON Stretch Remember that while it’s a good idea to have one person primarily responsible for typing (the driver) and the other reviewing each line of code and making suggestions (the navigator) you must switch roles after every problem. 1). List Construction Write a Python program that prompts the user to enter a sequence of lowercase words and stores in a list only those words whose first letter occurs again elsewhere in the word (e.g., "baboon"). Continue entering words...
Create a new NetBeans project (using Ant) titled YourNameExam2P3. 2. Pretend you are a malware author...
Create a new NetBeans project (using Ant) titled YourNameExam2P3. 2. Pretend you are a malware author and you are trying to come up with random-looking web domain names for your command-and-control viruses, e.g. “RDf-45dlfjxg7.com”. 3. First, you need to come up with some original criteria that define your domain name pattern. For example, “it should be 13 characters long, include 3 integers only, no lower case letters, and possibly end in .net or .edu”. You should come up with your...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take the array and its size as input params and return a bool. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out...
Chapter 8: Searching, Extracting, and Archiving Data Exercise 8.a: Using grep, find, and regular expressions (Objective...
Chapter 8: Searching, Extracting, and Archiving Data Exercise 8.a: Using grep, find, and regular expressions (Objective 3.2) Linux Distribution: Fedora (non-root user & password needed) Desktop Environment: GNOME 3 1.   If you have not already done so, boot up your computer (or virtual machine) to start the Fedora Linux distribution. 2.   When the machine has booted up, access the tty2 virtual terminal by pressing Ctrl+Alt+F2. 3.   Log on to a regular user’s account by typing in the username at the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT