Question

In: Computer Science

2. An 8-digit password is required to have three 0’s and five 1’s. You will determine...

2. An 8-digit password is required to have three 0’s and five 1’s. You will determine how many unique passwords are possible. First consider how you might notate possible outcomes in the process of listing them. For example, any of the following can represent the same outcome: 01011101 137 (the digits are the locations of the 0’s) 24568 (the digits are the locations of the 1’s) Write a program that lists and counts the unique passwords. Provide your code, all outcomes, and the count. (Python)

Solutions

Expert Solution

Look at my code and in case of indentation issues check the screenshots.

---------main.py----------------

def main():
   count = 0
   #We have to find position of zeroes
   for i in range(0,8):           #position of first zero in a password is at index i
       for j in range(i+1,8):       #position of second zero in a password is at index j
           for k in range(j+1,8):   #position of third zero in a password is at index k
               count = count + 1   #increment password count
               password = [1]*8   #create password as a list with all 1's
               password[i] = 0       #set the position indices of zeroes with value 0
               password[j] = 0
               password[k] = 0
               for letter in password:   #print the password
                   print(letter, end = "")
               print()               #newline
   print("Count: ", count)           #print count
main()

---------Screenshots---------------

------Output--------------

--------------------------------------

Do comment if you need any clarification.
Please let me know if you are facing any issues.
Please Rate the answer if it helped.

Thankyou


Related Solutions

An 8-digit password is required to have exactly three 0’s. The other 5 digits can be...
An 8-digit password is required to have exactly three 0’s. The other 5 digits can be any number 1-7, but numbers 1-7 may not be repeated. Write a program that lists all the possible outcomes. Provide your code and first 100 outcomes (Python).
How many arrangements of six 0's, five 1's and four 2's are there in which (a)...
How many arrangements of six 0's, five 1's and four 2's are there in which (a) the first 0 precedes the first 1? (b) the first 0 precedes the first 1, which precedes the first 2?
You need to create a four-digit password using 0-9. How many passwords are possible, without repeating...
You need to create a four-digit password using 0-9. How many passwords are possible, without repeating a number, if a password must not start with a 0?
- Determine the number of three-digit area codes that can be made from the digits 0-9,...
- Determine the number of three-digit area codes that can be made from the digits 0-9, assuming the digits can repeat. - Suppose that there are 15 people in a class. How many ways can the instructor randomly pick three students, if the order doesn’t matter? -You are playing a game at a local carnival where you must pick a card from a normal 52-card deck. If you pick a face card (jack, queen or king) you get $2. If...
4. The check digit for ISBNs is one of the numbers 0, 1, 2, . ....
4. The check digit for ISBNs is one of the numbers 0, 1, 2, . . . , 9, or the letter X. One of the your fellow students comments ”Gee, it sure is a pain to have to use that X all time. Why don’t they just compute the check digit sum modulo 10 instead of modulo 11, so that we can get rid of the X?” Would this plan work? Prove your answer. Assume that all ISBNs are...
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4...
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4 . Let W denote the row space for A. (a) Find an orthonormal basis for W and for W⊥. (b) Compute projW⊥(1 1 1 1 1 ).
Determine whether S is a basis for R3. S = {(4, 2, 5), (0, 2, 5),...
Determine whether S is a basis for R3. S = {(4, 2, 5), (0, 2, 5), (0, 0, 5)} S is a basis for R3.S is not a basis for R3.     If S is a basis for R3, then write u = (8, 2, 15) as a linear combination of the vectors in S. (Use s1, s2, and s3, respectively, as the vectors in S. If not possible, enter IMPOSSIBLE.) u =
Consider the set of five numbers {0, 2, 4, 6, 8}. 1) Make a list of...
Consider the set of five numbers {0, 2, 4, 6, 8}. 1) Make a list of all possible samples of size 2 that can be drawn from this set of integers. (Sample without replacements, that is, once a number is selected, you don’t put it back in the sample set.) 2) Make a list of all possible sample means for samples of size 2 selected from this set. 3) List the distribution of the sample means and construct a histogram...
If one? three-digit number? (0 cannot be a left? digit) is chosen at random from all...
If one? three-digit number? (0 cannot be a left? digit) is chosen at random from all those that can be made from the following set of? digits, find the probability that the one chosen is not a multiple of 5 . (0,1,2,3,4,5,6)
Assume set of input alphabets = {a, b} If last digit = 0, 1, 2 OR...
Assume set of input alphabets = {a, b} If last digit = 0, 1, 2 OR 3 Solve the following Design and Turing Machine that Accepts only odd length palindromes and rejects all the remaining strings If last digit = 4, 5 OR 6 Solve the following Design and Turing Machine that Accepts only even length palindromes and rejects all the remaining strings If last digit = 7, 8 OR 9 Solve the following Design and Turing Machine that Accepts...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT