1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marusya05 [52]
3 years ago
3

Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Uppercase

words should take precedence over lowercase words. For example, 'Z' comes before 'a'.
Computers and Technology
1 answer:
Alex Ar [27]3 years ago
6 0

Answer:

unique = []

with open("file_name.txt", "r") as file:

   lines = file.readlines()

   for line in lines:

       # assuming comma is the only delimiter in the file

       words = line.split()

       for word in words:

           word = word.strip()

           if word not in unique:

               unique.append(word)

unique = sorted(unique)

print(unique)

Explanation:

The python module opens a file using the 'with' keyword (the file closes automatically at the end end of the indentation) and the open built-in function and reads the content of the open file as a list of lines of the content.

Each line is split into a list and the unique words are collected and stored in the unique list variable.

You might be interested in
Suppose that you are developing an application in which you want to connect to a server to upload some data. You create a socket
miskamm [114]

Answer:

a.The server's IP address or hostname.

d.The port number for the application on that server

Explanation:

We can point out that a socket is a tool which contains or which comprises of a pair of value.

Also a socket is an end point which identifies each other. In this case the client connecting to the server.

From the options a and d meets the criteria.

4 0
3 years ago
XML Schemas consist of:
Contact [7]
None of the above is correct

4 0
3 years ago
What laws are broken when you hack someone?
postnew [5]

Answer:

it depends

Explanation:

if you are hacking for a purpose that is benefiting the person being hacked, that is ethical hacking. ethical hacking is not illegal, as long as you get permission from the person being hacked.

if you hack someone without their knowledge, that is unethical hacking, and that is in many cases, a crime, and if it has enough of a detrimental effect on a companys process, it could land you into prison and earn you a hefty fine.

ethical hacking is good for testing a networks security, and if all is well, the ethical hacker shouldnt be able to get into a network if it is secured properly.

6 0
3 years ago
What feature allows you to access previous copies of a document on OneDrive?
irga5000 [103]

Version history feature

OneDrive's Version history feature allows you to view older versions of an Office Online document. If you find a version you want, you can then restore it, moving it to the top of the list as the latest version of the file.

3 0
3 years ago
Read 2 more answers
with the current computer development, explain 5th areas where computer is applied for the social economic dwvelopment in societ
AleksandrR [38]

Explanation:

just want points tbh but have a good day

7 0
3 years ago
Other questions:
  • The BIOS feature that enables a hard drive to read or write several sectors at a time is called what?
    5·1 answer
  • What is last mile in VOIP
    13·1 answer
  • 1. Of which of the following is a box an example?
    10·2 answers
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • Renting provides _________ flexibility but can lead to _________ costs in the long-term.
    14·2 answers
  • You want to average the numbers in the range b1:b30. you have named this range of cells data and wish to use this range name in
    9·1 answer
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • Question Mode Matching Question Match the following description with the appropriate programming language generation. 1GL 1GL dr
    7·1 answer
  • Create a presentation on “Pets” and customize your presentation in the following ways:
    10·1 answer
  • What is one of the benefits of using a library in a program?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!