Question

Most of the current rules for how to set passwords are counter-productive, as nicely illustrated by...

Most of the current rules for how to set passwords are counter-productive, as nicely illustrated by Randall Monroe's xkcd comic:

As he points out, a better method is to pick several unrelated words and combine them.

This site has a large list of words that you can use to generate a good password:

https://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain (Links to an external site.)

Copy the words from that site into a text file (one word per line is easiest).

Write a python program that imports those words from your text file into a tuple, list or array. Then write a function that will generate a password from <n> (this should be an input to the function) random words chosen from the data structure. Each random word should be capitalized. You can use a built-in function to capitalize each word, or write your own!

Sample results might look like:

request 4 words - TreatmentCatUncleParty
request 3 words - PipeBoundarySkin

Your main program should ask for a security "level" from 1 (casual) - 5 (top secret). Then it should use your function to generate a password based on the security level with "level + 2" random words. Attach your text file of words to the assignment as well (.txt, .dat and .csv extensions are all allowed)

Homework Answers

Answer #1

Python Program:

import random

def capitilizingWords(lines, n):
    randomWords = random.sample(lines, n) # Randomly choose n number of words from list
    capitalWords = [word.title() for word in randomWords] # Capitilizing each words in randomly choosen list
    print("Requested {0} words - ".format(n), "".join(capitalWords)) # Printing output


# Main Driver Function
if __name__ == '__main__':
    # Add all texts in file into list
    lines = []
    with open("input.txt") as f:    
        for line in f:
            lines.append(line.strip())
            
    n = int(input("Enter Number Of Words: ")) # Input how many words you want
    capitilizingWords(lines, n) # Function to Capitilizing words

Output 1:

Output 2:

Thumbs Up Please !!!

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
** Language Used : Python ** PART 2 : Create a list of unique words This...
** Language Used : Python ** PART 2 : Create a list of unique words This part of the project involves creating a function that will manage a List of unique strings. The function is passed a string and a list as arguments. It passes a list back. The function to add a word to a List if word does not exist in the List. If the word does exist in the List, the function does nothing. Create a test...
Develop a C++ PROGRAM which will find a hidden sentence in a list of random words...
Develop a C++ PROGRAM which will find a hidden sentence in a list of random words using map function Open this text file named shuffled_words.txt in your program If it matters, you may presume there are an even number of words in the file Place the contents of the file into an appropriate data structure in the following manner: Grab a pair of strings from the file (unless end of file is reached) Each string is separated by a space...
you're tasked with performing a sentiment analysis on top articles in a sub-rddit. If you are...
you're tasked with performing a sentiment analysis on top articles in a sub-rddit. If you are unfamiliar with Reddit, here are some API urls to a few sub-rddits: - `worldnews` URL: https://www.rddit.com/r/worldnews/top.json - `writingprompts` URL: https://www.rddit.com/r/writingprompts/top.json - `todayilearned` URL: https://www.rddit.com/r/todayilearned/top.json - `explainlikeimfive` URL: https://www.rddit.com/r/explainlikeimfive/top.json - `politics` URL: https://www.rddit.com/r/politics/top.json From these URLs you should be able to figure out the pattern for any sub-rddit such as `news`, or `ama`. Start by getting the Rddit API to work, for the URL above...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
Data For Tasks 1-8, consider the following data: 7.2, 1.2, 1.8, 2.8, 18, -1.9, -0.1, -1.5,...
Data For Tasks 1-8, consider the following data: 7.2, 1.2, 1.8, 2.8, 18, -1.9, -0.1, -1.5, 13.0, 3.2, -1.1, 7.0, 0.5, 3.9, 2.1, 4.1, 6.5 In Tasks 1-8 you are asked to conduct some computations regarding this data. The computation should be carried out manually. All the steps that go into the computation should be presented and explained. (You may use R in order to verify your computation, but not as a substitute for conducting the manual computations.) A Random...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the codes below. Requirement: Goals for This Project:  Using class to model Abstract Data Type  OOP-Data Encapsulation You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing associated with the assignment it is failing one part of testing.   Below is the test that fails: Failed test 4: differences in output arguments: -c input data: a b c -c expected stdout: b observed stdout: a b expected stderr: observed stderr: ./test: invalid option -- 'c' Unsure where I have gone wrong. MUST BE WRITTEN IN C++ Task Level 1: Basic operation Complete...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT