Question

Counting Tuples: Count the number of passwords of length 3 that begin with a letter of...

Counting Tuples:

Count the number of passwords of length 3 that begin with a letter of the alphabet and consist of one lowercase letter, one uppercase letter, and one decimal digit

Homework Answers

Answer #1
def countingTuples(t):
    count = 0
    for x in t:
        if(len(x) == 3):
            hasLower = False
            hasUpper = False
            hasDigit = False
            for y in x:
                if y.islower():
                    hasLower = True
                if y.isupper():
                    hasUpper = True
                if y.isdigit():
                    hasDigit = True
            if hasLower and hasUpper and hasDigit:
                count += 1
    return count

# Testing
print(countingTuples(("qweweq","sA3","qwqee2131","As3","3dF","qwe122wA")))

3

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
Discrete structures/ counting tuples: Count the number of passwords of length 3 that begin with a...
Discrete structures/ counting tuples: Count the number of passwords of length 3 that begin with a letter of the alphabet and consist of one lowercase letter, one uppercae letter, and one decimal digit
Imagine you are developing a software package that requires users to enter their own passwords. Read...
Imagine you are developing a software package that requires users to enter their own passwords. Read the input as a C-string or a string object. Your software requires that users’ passwords be sent to special functions that will verify if the characters used meet the following criteria: The password should be at least six characters long. The password should contain at least one uppercase and at least one lowercase letter. The password should have at least one digit. Write a...
Decide the best way to solve the below problem. The number of five-letter passwords that can...
Decide the best way to solve the below problem. The number of five-letter passwords that can be created when letters can be repeated Factorial Addition Rule Permutation Distinguishable Permutation Fundamental Counting Principle Combination Multiplication rule
How many possible passwords are there, given the following restrictions: Must be between 4 and 6...
How many possible passwords are there, given the following restrictions: Must be between 4 and 6 characters long Must begin with ‘A’ May only contain letters (uppercase or lowercase) and digits (6-4) * (26*2 + 10) (26*2 + 10)3 + (26*2 + 10)4 + (26*2 + 10)5 (26*2 + 10)4 + (26*2 + 10)5 + (26*2 + 10)6 (26*2 + 10)(6-4) Which is true? Recursive algorithms are sometimes simpler than non-recursive algorithms Recursive algorithms are more efficient than non-recursive algorithms...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total 52 case sensitive) and five special characters (‘.’, ‘,’, ‘:’, ‘;’ and ‘!’) in all the .txt files under a given directory. The program should include a header count.h, alphabetcount.c to count the frequency of alphabet letters; and specialcharcount.c to count the frequency of special characters. Please only add code to where it says //ADDCODEHERE and keep function names the same. I have also...
Count the number of letter As in each page for the first 10 pages of the...
Count the number of letter As in each page for the first 10 pages of the novel ( do not differentiate capital letter and lower case letter) Please report your data first. Here is the data Page 1 = 163 As Page 2 = 117 As 3 = 131 4 = 159 5 = 89 6 = 107 7 = 95 8 = 181 9 = 211 10 = 153 1. Use you data from the first page, calculate the...
Combinatorics Let n be a positive counting number, and consider words of length n using letters...
Combinatorics Let n be a positive counting number, and consider words of length n using letters { 0 , 1 } . For example, 1011101 is such a word of length 7 , and 1001 is such a word of length 4 . Let w(n) equal the number of words of length n with no adjacent zeros. For example, w(1) = 2 since there are two words of length 1 with no adjacent zeros: 0 and 1 . And, w(2)...
2) Allowing (or requiring) users to use numerical digits (including 0) and one of 28 “special...
2) Allowing (or requiring) users to use numerical digits (including 0) and one of 28 “special characters” dramatically increases the number of possible passwords. Furthermore, passwords often are case-sensitive, effectively doubling the size of the alphabet by defining 52 distinct letter characters.    Assuming that passwords are case-sensitive and can include numerical digits and special characters, how many possible 6, 8 and 10 character passwords can be created? (8 points) 3) Allowing digits and special characters creates an enormous number...
3. A password is a sequence of letters (a–z) and digits (0–9). Find the number of...
3. A password is a sequence of letters (a–z) and digits (0–9). Find the number of passwords of length 10 under the constraints in (a), (b) or (c) (three separate problems). Express your answer using factorials and integers, products and ratios of them, and/or sums of such things. (a) There are 3 letters and 7 digits, and at most one ‘9’. (b) There are 6 letters and 4 digits, and no digit occurs twice. (c) No letters are used BUT...
The initial size of the bacteria is 1000. After 3 hours the bacterium count is 5000....
The initial size of the bacteria is 1000. After 3 hours the bacterium count is 5000. a. Find the function to model the bacteria population after t hours.(Round your r value to four decimal places. b. Find the population after 6.5 hours. Round your answer to the nearest whole number. c.When will the population reach 14,000? Round your answer to one decimal place.