Instructions
Complete the program below. The program should be turned in as a .py file. Please turn in the .py file itself (do not take a picture of it or copy/paste it into another program). Please also turn in the output for your program. The output should be in a different file. You may find the easiest way is to take a screenshot of your output. You can use the snipping tool on Windows or the grab tool on a Mac to take pictures of your output. You may want to put all of your output pictures in a single Word file.
Criteria for Success
Please view the rubric to ensure you are completing everything you need. You are required to use functions. In addition, make sure the output examples you turn in show a variety of test cases. You can create a test() function in your program to prove the majority of your code works.
Password Validator
When users create a new account on a website, they are often asked to create a new password. Many websites then test the password to make sure it is strong enough before allowing a user to save it. If it's not strong enough, the user needs to create a new password.
In this program, you will ask a user for a username/password combination and test for password strength according to the following rules:
Your program will prompt for a username. Then, it will prompt for a password. Your program should check the password. If the password is OK, print "Good Password!" and end the program. If the password is NOT OK, print the appropriate message to the user. Continue reprompting until the user successfully picks a good password.
If there are multiple problems with the password, you only need to report one.
Consider: Is this the most user-friendly approach?
No. It's not. But it does seem some websites continue to hassle the user this way, while others let the user know up front what is expected... And give better error messages than these, often reincluding what is required. I prefer those sites. However, I want you to write the code that can give specific errors.
Obvious Password
Rule: If a password contains 1 or more of the following Strings (ignore case):
Message to user: Don't use common passwords
Too Short Password
Rule: Password must be at least 8 characters long
Message to user: Password must be at least 8 characters long
Too Long Password
Rule: Password must be less than 21 characters long
Message to user: Password must be less than 21 characters
Low Complexity Password
Rule: The password must contain at least 1 character each of:
Message to user: Passwords must contain both upper and lower case letters, at least one digit and at least one punctuation mark (!+.@$%*)
Unrecognized Character
Rule: Your company's back-end systems don't like certain characters. Therefore, the password must only contain:
Message to user: Password contains an Invalid Character
Other Issues
Rule: If the password has one of the following issues, alert the user of the issue and have them choose a new one.
Message to User: Passwords can't contain a variation of the username
Pig Latin Translator
Write a program that asks the user for a sentence and converts it to Pig Latin. The below explains how to convert to Pig Latin:
If the first letter is a vowel (a, e, i, o, u):
If the first letter is a consonant (treat the letter "y" as a consonant):
Words that have their first letter capitalized, should continue to have the (possibly new) first letter capitalized.
Sentences end with a period (.), an exclamation point (!) or a question mark (?). Make sure the punctuation continues to stay at the end of the sentence.
| English | Pig Latin |
| sleep | leepsay |
| the | hetay |
| python | ythonpay |
| computer | omputercay |
| pig | igpay |
| Latin | Atinlay |
| if | ifway |
| other | otherway |
| only | onlyway |
| apple | appleway |
Sentences occassionally have other punctuation such as commas (,) and semicolons (;). Make sure these punctuation marks stay put.
For example:
Original sentence: Hello World!
Right: Ellohay orldway!
NOT: elloHay orld!Way
Original sentence: To be, or not to be?
Right: Otay ebay, orway otnay otay ebay?
NOT: oTay e,bay orway otay e?bay
You only have to deal with the 5 punctuation marks mentioned (. ! ? , ;)
In: Computer Science
Of 250 adults selected randomly from one town, 72 of them smoke. Construct a 95% confidence interval for the true percentage of all adults in the town that smoke
In: Statistics and Probability
. The mean monthly mortgage paid by all home owners in
a town is $2365
with a standard deviation of $340. Use Chebyshev’s Theorem to find
the
following quantities.
(a) (2 points) The minimum percentage of all home owners in this
town
who pay a monthly mortgage of $1685 to $3045.
(b) (3 points) The interval that contains the monthly mortgage
pay-
ments of at least %84 of all home owners in this town.
In: Statistics and Probability
The Sacramento area was founded on the prospect of gold. Gold discovery in nearby Coloma brought countless people west with hopes of richer days and better choices for their families. In collaboration with a local merchant Sam Brannan, John Sutter and his family founded the city of Sacramento in 1848. In April of 1849, the population of the area was estimated at 150 people. By October of the same year, the population grew to a whopping 6,000 people (Wiegand, 1998). In mid-October of 1850 it is reported that a riverboat named the “New World” arrived in the area with a single passenger carrying the deadly cholera disease. As a result of exposure to cholera, reports indicated that within three weeks 800 people died of the disease. Many of those that perished are buried in a common grave located at the Old City Cemetery located at 1000 Broadway Street in Sacramento. Approximately 80 physicians were working during the time of the cholera outbreak, and 17 died from cholera within a year after initial exposure (Old City Cemetery, 2005). What type of outbreak is this? Explain and include aspects of how exposure occurred, description of whether it is epidemic, pandemic, or endemic, type of exposure etc.
In: Biology
IN PYTHON
1) Pig Latin
Write a function called igpay(word) that takes in a string word representing a word in English, and returns the word translated into Pig Latin. Pig Latin is a “language” in which English words are translated according to the following rules:
For any word that begins with one or more consonants: move the consonants to the end of the word and append the string ‘ay’.
For all other words, append the string ‘way’ to the end.
For the above you can assume that ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’ are vowels, and any other letter is a consonant. This does mean that ‘y’ is considered a consonant even in situations where it really shouldn’t be.
For this exercise, you can assume the following:
There will be no punctuation.
All letters will be lowercase
Every word will have at least one vowel (so we won’t give you a word like “by”)
Write a helper function that finds the index of the first vowel in a given word, and use that in your main function.
Hints:
To find the index of the first vowel in a given word, since you’re interested in the indexes, looping through the indexes of the string using range, or enumerate, or a while loop may work better than a direct for loop on the characters.
Use slicing to break up the string into all of the letters before the vowel, and all of the letters from the vowel onwards.
Examples:
>>> igpay('can')
'ancay'
>>> igpay('answer')
'answerway'
>>> igpay('prepare')
'eparepray'
>>> igpay('synthesis')
'esissynthay'
In: Computer Science
In: Physics
Controllership in Accounting
Employment Rules vs Personal & Privacy Concerns
Characters: Sandy, the controller of ABC, Inc., a small manufacturing company
Jacob, the controller of Micro, Inc., a small manufacturing company
Sandy is a controller of ABC, Inc., a small regional manufacturing company. During her
four years of employment at ABC, she has worked her way up through the ranks. She has
been the controller for the past year and has consistently received favorable evaluations.
Sandy enjoys her work and is good at what she does.
ABC, Inc., is close to finalizing a merger with Micro, Inc., a similar manufacturing company.
The merger will be finalized in two weeks, on July 1. When the companies merge, various
positions will be eliminated to avoid duplication of efforts in the merged company. A variety
of positions will be cut, including manufacturing workers, office staff, and management
positions. The decisions on personnel cuts will be announced August 1.
Jacob, the controller of Micro, Inc., has been with that company for less than a year. He is
perceived favorably by management. The newly merged company will need only one
controller, and Sandy has received unofficial confirmation that she will be the controller of
the new firm and that Jacob will be dismissed.
Sandy has had significant responsibility for her parents during the past two years. Her
father has terminal cancer, and the specialist has given him only six months to live. Her
mother is emotionally distressed and needs special attention from time to time. In addition,
after years of trying, Sandy has recently found out that she is pregnant. She plans to take a
short maternity leave and then return to work full-time.
Sandy realizes the time demands of her current and experted family and also the time
demands of working as the controller of the newly merged company. She feels that she will
be able to balance her personal and professional life in such a way that her job performance
will not suffer. Yet, she wonders if she should make her boss aware of her responsibility to
her parents and her pregnancy.
Answer the following questions from the case above :-
1. What are the relevant facts of the case?
2. What, if any, are the ethical issues?
3. Who are the stakeholders?
4. What are the possible alternatives including any ethical concerns?
5. What are the practical constraints?
6. What action(s) should be taken?
In: Accounting
Match the research design to the correct test statistic. Each research design may be used more than once.
|
A.
Factorial ANOVA
B.
Dependent samples t-test
C.
Correlation
D.
One-way ANOVA
E.
Independent samples t-test
F.
Repeated Measures ANOVA
In: Statistics and Probability
The accompanying table describes results from groups of 8 births from 8 different sets of parents. The random variable x represents the number of girls among 8 children. Complete parts (a) through (d) below. LOADING... Click the icon to view the table. a. Find the probability of getting exactly 1 girl in 8 births.Number of Girls x P(x) 0 0.002 1 0.028 2 0.117 3 0.217 4 0.272 5 0.217 6 0.117 7 0.028 8 0.002
In: Statistics and Probability
The accompanying table describes results from groups of 8 births from 8 different sets of parents. The random variable x represents the number of girls among 8 children. Complete parts (a) through (d) below. . Find the probability of getting exactly 1 girl in 8 births. P(x) Number of Girls x P(x) 0 0.002 1 0.022 2 0.117 3 0.227 4 0.264 5 0.227 6 0.117 7 0.022 8 0.002
In: Statistics and Probability