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...
Program Behavior Each time your program is run, it will prompt the user to enter the...
Program Behavior Each time your program is run, it will prompt the user to enter the name of an input file to analyze. It will then read and analyze the contents of the input file, then print the results. Here is a sample run of the program. User input is shown in red. Let's analyze some text! Enter file name: sample.txt Number of lines: 21 Number of words: 184 Number of long words: 49 Number of sentences: 14 Number of...
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...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may...
PYTHON : Create a Email Address Parser (* Please do make comments*) Often times, you may be given a list of raw email addresses and be asked to generate meaningful information from such a list. This project involves parsing such a list and generating names and summary information from that list. The script, eparser.py, should: Open the file specified as the first argument to the script (see below) Read the file one line at a time (i.e., for line in...
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...
Question 21 ​By default, most wireless networks are ____. a. ​secured by WEP b. ​password-locked c....
Question 21 ​By default, most wireless networks are ____. a. ​secured by WEP b. ​password-locked c. ​secured by WPA or WPA2 d. ​left unsecured 1 points Question 22 ​Choosing Image Editing and Illustration Programs a. ​non-lossy b. ​linear c. ​bitmap d. ​vector 1 points Question 23 ​Computer-generated graphics come in two varieties: ____ and vector. a. ​linear b. ​raster c. ​angular d. ​digital 1 points Question 24 ​Currently, WWANs provide wireless connections to the Internet using ____ networks created by...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT