Reference no: EM132356999
Assignment
For this assignment you will be writing a series of programs that should be stored in their own "py" files. The filenames you should use are listed at the end of each part. When you're finished you should submit your program to the Assignment category inside of NYU Classes.
Part 1a
You have been asked to write a username validation program for a small website. The website has specific rules on what constitutes a valid username, including:
•All usernames must be between 8 and 15 characters long
•Usernames can only contain alphabetic (a-z and A-Z) and numeric characters (0-9) - no special characters or spaces are allowed.
•The first and last characters in a username cannot be a digit
•Usernames must contain at least one uppercase character
•Usernames must contain at least one lowercase character
•Usernames must contain at least one numeric character
Write a program that asks the user to enter in a username and then examines that username to make sure it complies with the rules above.
Part 1b
The company you are working for was very happy with your username validator, and now they want you to write a password validator for their website. Here are the rules for passwords:
• Passwords must be at least 8 characters long (but they do not have an upper limit)
• Passwords cannot contain the user's username (i.e. if the username is "My1stUsername" the password cannot be "abcMy1stUsername" or "My1stUsernameABC" because the username can be found inside of the password String)
• Passwords must be a mixture of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9) and a select number of special characters (#, $, % and &). The password must contain at least one of each of these types of characters in order to be valid.
You can make a copy of Part 1a and place your password validator code directly after your username validator. Here's a sample running of the program. Note that you need to continually ask the user for a password until they supply a good one.
Part 2a
Numerology is the "study of the purported mystical or special relationship between a number and observed or perceived events." It has been used throughout human history as a way to attach meaning to a name, object or event using mathematics. It is considered a "pseudoscience" by modern scientists since it has no basis in observable phenomena. With that said, it makes a great programming challenge so we're going to go with it! :)
What you want to do for this project is to ask the user to type in their name. Next, you will need to use a technique called "theosophical reduction" to convert their name into a number. With this technique we assign each letter of the alphabet its own number. For example, the letter "a" is equal to the number 1. "b" = 2, "c" = 3, "z" = 26, etc. You should ignore non-alphabetic characters (i.e. numbers, spaces and special characters)
Once you've gotten all of the letters converted into numbers you can add them up into one single number. This is the "numerology number" for the name that the user entered.
Part 2b
Classic numerology ascribes meaning to the following numbers:
•0 = emptiness, nothingness, blank
•1 = independence, loneliness, creativity, originality, dominance, leadership, impatience
•2 = quiet, passive, diplomatic, co-operation, comforting, soothing, intuitive, compromising, patient
•3 = charming, outgoing, self expressive, extroverted, abundance, active, energetic, proud
•4 = harmony, truth, justice, order discipline, practicality
•5 = new directions, excitement, change, adventure
•6 = love, harmony, perfection, marriage, tolerance, public service
•7 = spirituality, completeness, isolation, introspection
•8 = organization, business, commerce, new beginnings
•9 = romatic, rebellious, determined, passionate, compassionate
However, you might recall from the previous problem that the sample input ("craig") reduced to the number 38. 38 is not on the "personality trait" lookup table above, so we need to further reduce the number by adding up its individual digits.
Part 3a
For this part you will be writing a series of functions that can be used as part of a "secret message encoder" program. Here are the functions you will be writing as well as some sample code that you use use to test your work.
Part 3b
Now you are going to write an "encoder / decoder" program that makes use of your three cryptographic functions. Begin by writing a program that continually asks the user to enter in an option - the user can either (e)ncode a word, (d)ecode a word or (q)uit the program.
If the user chooses to encode a word you should do the following:
•Ask the user for a positive number between 1 and 5. Reprompt them if necessary.
•Next, ask them to enter in a phrase that they want to encode.
•Finally, apply the following algorithm to their word:
oAdd 'num' random characters in between each letter of their word (using your add_letters) function
oShift the word 'num' characters (using your shift_characters function)
If the user chooses to decode a word you should do the following:
•Ask the user for a positive number between 1 and 5. Reprompt them if necessary.
•Next, ask them to enter in a phrase that they want to encode.
•Finally, apply the following algorithm to their word:
oSubtract 'num' random characters in between each letter of their word (using your remove_letters) function
oShift the word DOWN by 'num' characters (using your shift_characters function)
Part 4
For this part you will be implementing a series of commonly used String functions and methods by writing your own functions. These functions should behave just like their commonly used counterparts.