14 Apr Assignment Rules: Open book and notes assignment This homework tests your knowledge of File Handling, use of String methods, and use of Sets. A
Assignment Rules:
Open book and notes assignment
- This homework tests your knowledge of File Handling, use of String methods, and use of Sets.
- Adhere to the naming conventions discussed in class for variable names, program name and function names
- Use meaningful names for variables, functions etc
- If there are two words in the variable use first word lowercase and first letter of second word upper case i.e., firstName or underscore between 2 words i.e first_name
- Include appropriate comments in the code
- Output should be displayed similar to as mentioned against each problem
- Indent the lines of code appropriately
1. char_analysis.py (40 points)
Write a program that reads the file's contents and determine the following:
- The number of Uppercase letters in the file
- The number of Lowercase letters in the file
- The number of digits in the file
- The number of whitespace characters in the file
HINTS:
Define main():
Declare Local variables
Open file text.txt for reading. Use 'text.txt' file available under the Modules section in Canvas.
Use for loop to step through each character in the file.
Determine if the character is uppercase, lowercase, a digit, or space, and keep a running total of each.
Close the file.
Display the totals of uppercase, lowercase, digits, spaces.
Sample Output:
Uppercase letters: 29
Lowercase letters: 1228
Digits: 30
Spaces: 260
2. unique.py (30 points)
Write a program that opens a specified text file (text2.txt) and displays a list of all unique words found in the file.
HINTS:
Define main():
Declare Local variables
Open file text2.txt for reading. Use 'text2.txt' file available under the Modules section in Canvas.
Use 'set' method to find the unique words in the file and store each of them as an element of the set.
Close the file.
Display all the unique words from the set.
Sample output:
These are the unique words in the text:
management.
name
been
later,
canceled,
is
Eastern,
delay
Eight
1,820
at
it
1867
official
world
and
company,….
3. name.py (30)
Write a program that gets a string containing a person's first, middle, and last names, and displays their first, middle, and last initials. For example, if the user enters Susan Smith Miller, the program should display S.S.M.
Define main():
Declare Local variables
Prompt user to enter the full name
Use 'split' method to split the full name
Use for loop to get first character of each name as an initial
Convert the first character to upper case if it is already not in upper case
Display output
Sample output:
Enter your full name: Susan Smith Miller
S.S.M.
No one is unaware of the name of that famous English shipowner, Cunard. In 1840 this shrewd industrialist founded a postal service between Liverpool and Halifax, featuring three wooden ships with 400-horsepower paddle wheels and a burden of 1,162 metric tons. Eight years later, the company's assets were increased by four 650-horsepower ships at 1,820 metric tons, and in two more years, by two other vessels of still greater power and tonnage. In 1853 the Cunard Co., whose mail-carrying charter had just been renewed, successively added to its assets the Arabia, the Persia, the China, the Scotia, the Java, and the Russia, all ships of top speed and, after the Great Eastern, the biggest ever to plow the seas. So in 1867 this company owned twelve ships, eight with paddle wheels and four with propellers. If I give these highly condensed details, it is so everyone can fully understand the importance of this maritime transportation company, known the world over for its shrewd management. No transoceanic navigational undertaking has been conducted with more ability, no business dealings have been crowned with greater success. In twenty-six years Cunard ships have made 2,000 Atlantic crossings without so much as a voyage canceled, a delay recorded, a man, a craft, or even a letter lost. Accordingly, despite strong competition from France, passengers still choose the Cunard line in preference to all others, as can be seen in a recent survey of official documents. Given this, no one will be astonished at the uproar provoked by this accident involving one of its finest steamers.
,
No one is unaware of the name of that famous English shipowner, Cunard. In 1840 this shrewd industrialist founded a postal service between Liverpool and Halifax, featuring three wooden ships with 400-horsepower paddle wheels and a burden of 1,162 metric tons. Eight years later, the company's assets were increased by four 650-horsepower ships at 1,820 metric tons, and in two more years, by two other vessels of still greater power and tonnage. In 1853 the Cunard Co., whose mail-carrying charter had just been renewed, successively added to its assets the Arabia, the Persia, the China, the Scotia, the Java, and the Russia, all ships of top speed and, after the Great Eastern, the biggest ever to plow the seas. So in 1867 this company owned twelve ships, eight with paddle wheels and four with propellers.
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteEdu. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
Do you need help with this question?
Get assignment help from WriteEdu.com Paper Writing Website and forget about your problems.
WriteEdu provides custom & cheap essay writing 100% original, plagiarism free essays, assignments & dissertations.
With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Chat with us today! We are always waiting to answer all your questions.