Assignment Rules: Open book and notes assignment This homework tests

Assignment Rules:
Open book and notes assignment

  1. This homework tests your knowledge of File Handling, use of String methods, and use of Sets.
  2. Adhere to the naming conventions discussed in class for variable names, program name and function names
  3. Use meaningful names for variables, functions etc
  4. 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
  5. Include appropriate comments in the code
  6. Output should be displayed similar to as mentioned against each problem
  7. 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:

  1. The number of Uppercase letters in the file
  2. The number of Lowercase letters in the file
  3. The number of digits in the file
  4. 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.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

patient file

Your final project for this course will be a patient record analysis. You will apply the knowledge of anatomy, physiology, and pharmacology that you have developed during this course in a thorough review of existing patient information in the Final Project Patient File. Specifically, you will review a patient’s history

610 6-1 Discussion: Improve, Part Two—Mitigating Unwanted Consequences

 The Essential Workplace Conflict Handbook. Including the IMPROVE Supplementary Document. Next, in your initial post, address the following: • In what ways do you perceive the Improve phase as being informed by the other phases of DMAIC that you have worked with in the course thus far? • How can

Code of conduct

 For this assignment, Write a paper about employee codes of conduct using information from your textbook and at least two other scholarly sources. First, research employee codes of ethics, especially for the medical field. Next, find some examples of employee codes of ethics from medical facilities and choose the one

Human Growth and Development

Scenario: Simon Whitaker is 42 years old and has suffered from mental illness since his late teens. He lives in a flat in a large housing estate. He lost his job as a warehouse cleaner after he was admitted to hospital the last time he became ill, two years ago.

Exporting Security

Write a 2 page argumentative essay on the links provided below. Link 1: https://www.airuniversity.af.edu/SSQ/Book-Reviews/Article/1292320/exporting-security-international-engagement-security-cooperation-and-the-changi/ Link 2:https://digital-commons.usnwc.edu/cgi/viewcontent.cgi?article=1049&context=nwc-review Link 3: https://digital-commons.usnwc.edu/cgi/viewcontent.cgi?article=1049&context=nwc-review #Exporting #Security

Organizational culture and values

 Details: Prepare a 10-minute presentation (10-15 slides, not including title or reference slide) on organizational culture and values. Describe how alignment between the values of an organization and the values of the nurse impact nurse engagement and patient outcomes. Discuss how an individual can use effective communication techniques to overcome

Document Analysis

Document Analysis (5% – c. 500 words) Primary sources are writings that were produced by individuals or groups at the time of the historical events or issues that they deal with. A number of such documents have been placed on Blackboard, organized by course unit. This assignment requires you to

M3D1: Big Data

The discussion will examine the social interaction of participants regarding an issue or situation and its impact on research data. This discussion addresses the following module outcomes: •MO1: Become familiar with the process of conducting marketing research methods and research tools •MO2: Review the process marketers use for identifying and

Case Study 1 and 2 Pneumonia and Addison diseases

Review the case study and answer all questions with a scholarly response using APA and include 2 scholarly references. Answer both case studies on the same document and upload 1 document to Moodle. Case Studies will be uploaded to Moodle and put through TURN-It-In (anti-Plagiarism program) Turn it in Score

Should schools ban unhealthy snack machines?

 Your outline should include: An explanation of the controversial issue, why is it controversial? Identify which position or side you will take in your paper, and explain why. If you don’t agree with the position you are taking discuss how this could affect your argument on the topic. If you

The Outcome of Inequality of Wealth and Income

Research Topic: Submit an idea for a research study based on a business/economic problem. • Write the title of the study. • Explain your overarching aim for the study. • What is the problem? • What is the significance of it? • Draft at least two research questions. Due 1/27

“practice of professional engineering”

1. “practice of professional engineering” means any act of planning, designing, composing, evaluating, advising, reporting, directing or supervising that requires the application of engineering principles and concerns the safeguarding of life, health, property, economic interests, the public welfare or the environment, or the managing of any such act; (“exercice de

Curriculum Development and Evaluation

 Learning Materials: Keating, S. B. (2011). Curriculum development and evaluation in nursing (2nd ed.). New York: Springer. (Chapter 13) Books are on website Vital Source user name is sred9196@yahoo.com, the password is Bungalow9@ • Exercise #1: Address an educational need among nursing staff at a health care agency. In the

Epidemiology and Surveillance

Research the public health agency in Chicago, IL and develop a presentation on its structure, response capabilities, surveillance tools, and role in emergency management. In your response, include a description of the community served by the department (Chicago), its emergency response structure, surveillance systems that are used at hospitals, biohazard

General Psychology Application

 General Psychology Application Essay Over the course of the class, we have discussed a number of different psychological concepts and theories. For your paper you will be asked to connect a real life experience or observation with a concept or theory from lecture and/or your textbook. Your assignment should include

Issues and Trends in Curriculum Development

 Learning Materials: • Iwasiw, C., Goldenberg, D., & Andrusyszyn, M. (2009). Curriculum development in nursing education (2nd ed.). Boston: Jones & Bartlett. (Chapters 13 and 14) • Keating, S. B. (2011). Curriculum development and evaluation in nursing (2nd ed.). New York: Springer. (Chapters 16 and 17) PowerPoint • Chapter 13

Foundation of Nursing Module 2.1 ( Discussion)

Module 2.1 – Discussion Nursing Theories and Theorists Instructions: After reading the assigned chapters, please post two discussion questions based on the readings along with your answers to the following questions: Did any of the theories or theorist influence your own personal theory of nursing; and consequently, your own view