Activity : Challenge Problems
Please try to make your program output look as much like the example as possible and verify it works with the example input provided. If you have difficulty finding the information or understanding how to approach the problem, you should contact me.
I want to push you a little bit. These two problems are really awesome problems but they have places that you need to really think hard. I encourage you to give them a try just to see what you can do. I encourage you to start early, try them, hit a point where you are close but not there yet, and then take the time to walk away and THINK for a few days before coming back and trying again.
Again, these are NOT part of your grade. But if you can figure these out with some thinking and some discussion with a classmater/partner than you are well on your way to really truly understanding programming.
- Challenge #1 - passwordStrength.py
- Challenge #2 - syllableCount.py
Challenge #1
Create a program named passwordStrength.py
Have you ever wondered what a website uses when they tell you that your password is weak or strong? This program will use one simple technique to calculate a password strength score and category.
- C. Cure is running a new competitor to Amazon.com and wants a program to help her tell customers if their passwords are good enough.
- In our program, lets produce a strength score that depends on:
- Length - one point per character
- Variability - one additional point each for each category contained in the password:
- lower-case letters
- upper-case letters
- digits
- special character
- Produce code that will
- accept a potential password as a string
- report its score
- [HINT: Suggestion, the score is the length plus a possible 4 bonus points TOTAL. It is better if you go through the password and count how many of each kind of character you have. Then, and only then, if the total for that category is more than 0 you can add 1 bonus point. The mistake most people make is they add the points too many times.]
- [HINT: To decide if a character is a lowercase, uppercase, or digit you can use the "in" command we looked at in the lecture videos along with Strings that you create that contain all of the possible characters in those cases. You may consider anything not already contained in these 26+26+10=62 characters as a "special" character.]
- report its strength
- weak (scores of 10 and below)
- okay (scores of 11-12)
- good (scores of 13-15)
- strong: (scores over 15).
- Here are some examples :
Challenge #2
Create a program named syllableCount.py- Rita Book is back.
- Have you ever used one of those websites that tells you the reading level of a book? For example:
- Green Eggs and Ham is a 1.5
- Henry and Beezus is a 4.6
- Harry Potter and the Chamber of Secrets is a 6.7
- The Great Gatsby is a 7.3
- Moby Dick is a 10.3
- We aren't ready to write code to generate that full score yet. But we can create one small piece of the process.
- Part of that calculation is looking at the average number of syllables per word. In order to calculate this we want to count the number of syllables in ONE word.
- While this is complicated in theory, there is actually a technique that is fairly accurate:
- Count the number of vowels in the word (including y). BUT:
- do not count an "e" at the end of a word
- do not count a vowel that comes after another vowel.
- Do not accept a score of 0. Always return at least a 1.
- Count the number of vowels in the word (including y). BUT:
- Here are several examples:
- Some things to note in the examples
- "we" SHOULD produce zero but is caught by a special exception.
- "unite" doesn't count the e at the end
- "syllable" actually has 3 syllables but this is the correct score
Testing Your Code
Note - Again, these challenge problems are not evaluated for a grade.
- Go to the AutoLab Homepage for the course
- https://hypnos.cs.uni.edu/courses/CSED1320-F21/assessments
- Log in if necessary
- For each of the assignments listed above, find their submission link under the "Practice" heading
- Upload the corresponding python file for that assignment.
- When the "handin history" page comes up you will need to refresh the page until a score of either 0 or 1 is shown with your assignment.
- Click on the 0/1 score to get feedback.
- Read the information carefully if you received a score of 0 and figure out what you need to do to fix the problem.
- Ask for help from me or other students if you don't understand an error message.
- Resubmit until the program earns a 1.