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'.

Answers

Answer 1

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.

Answer 2

The program is an illustration of file manipulations.

File manipulation involves writing to and reading from a file

The program in Python where comments are used to explain each line is as follows:

#This creates an empty list

wordList = []

#This opens the file

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

   #This reads the file, line by line

   lines = file.readlines()

   #This iterates through each line

   for line in lines:

       #This splits each line into words

       words = line.split()

       #This iterates through each word

       for word in words:

           #This removes the spaces in each word

           word = word.strip()

           #This adds unique words to the list

           if word not in wordList:

               wordList.append(word)

#This prints the unique words in alphabetical order

print(sorted(wordList))

Read more about similar programs at:

https://brainly.com/question/19652376


Related Questions

Which of the following is one of the first steps in implementing a comprehensive security program? Setting up a Guest account Creating hierarchical directory structures Setting a strong password policy Establishing forests

Answers

Answer:

Setting a strong password policy

Explanation:

In implementing a comprehensive security program, one of the first steps would be to set up a strong password policy.

It is important to understand what the company is trying to protect from third parties.

Setting up a password policy is going to increase the security of the system through the use of strong passwords.

1) If a robot has a 3 bit instruction set and needs 20 instructions to reach its destination, how many bits of memory are required?


2) A robot driven by a raspberry Pi has 256MB of memory. The robot has a 3 bit instruction set. What is the maximum number of instructions that can be loaded into the robot?

3) Imagine that the robot with 256MB of memory needs 500,000 4-bit instructions to perform a job. Would it be possible to load in all the 500,000 instructions into the memory of the robot?

Answers

Answer:

Explanat500,000ion:

pls help ...
Consider the code given below:
public class Testone {
public static void main (String[] args) throws Exception {
Thread.sleep (3000);
System.out.println("sleep");
}
)
What is the result?
Select one:
a. The code executes normally and prints "sleep".
b. The code executes normally, but nothing is printed.
a
C. A RuntimeException is thrown at runtime
d. Compilation fails
e. An exception is thrown at runtime.
Next pag​

Answers

Answer:

You open the class, and print sleep after thread 3000So A

Docker is focused on ______ containerization.

Answers

Answer:

Application

Explanation:

Docker is a known container technology platform that can help in the packaging of an application by a developer. It is a platform that is used by software developers to build applications based on containers. Using this containerization platform would enable the application to run without issues In any environment. That is either development, test or production environment.

In a binary search, which formula is used to find the index of the middle value?


middle = (first + last) * 2


middle = (first + last) // 2


middle = first + last // 2


middle = first + last * 2

Answers

Answer:

middle = (first + last) // 2

Explanation:

In binary search algorithm, the searching begins at the middle index and if the value searched for is not the middle element, it progresses to the left or right of the element depending on the size of the value compared to the middle element.

To determine the middle index, you add the first index to the last index and divide the result by 2. By doing this you eliminate half of the elements you have to search through.

Subsequent divisions eventually gets you to the element you're searching for in lesser time compared to if you had to search through every element in the array.

Pls due soon



Directions: Answer these questions as you navigate through the modules of the Computer Basics Tutorial.



Define computer:

What are the functions of a computer?

Name three ways in which you can use a computer?

Define hardware:

Define software:

Name at least four different types of computers.

What are the two main styles that personal computers come in?

What is the purpose of the operating system?

Name the three most common operating systems for PCs.

What does GUI stand for and what is its purpose?

In what year did Microsoft create Windows?

What is MAC OS?

What is Linux?

Name three operating systems designed specifically for mobile devices?

What is an App?

What are apps for mobile devices called?

Name six types of desktop applications?

Name three examples of mobile apps (does not have to come from the tutorial)?

What is the Cloud?

Name three services that use the Cloud?

Give at least one reason why someone would want to use the Cloud.

Give three examples of web apps?

What are the basic parts of a desktop computer and what purpose does each one serve?

Name two common mouse alternatives?

Name at least five peripherals?

What is the CPU/Processor of a computer?

How is the processor’s speed measured?

What is the motherboard and what purpose does it serve?

What does the power supply unit do?

What is RAM and what is it measured in?

What is a hard drive and what purpose does it serve?

What is the purpose of each of the following:

expansion card

video card

sound card

network card

Bluetooth card

What is a laptop computer and how is it different from a desktop computer?

What is a mobile device? Give three examples.

What is a smartphone?

What are 3G, 4G, and LTEs?

How is a tablet computer different from a laptop? What are some advantages and disadvantages of using a tablet?

What is the desktop and what features does it usually contain?

What is the purpose of using folders on the computer?

What is the purpose of the Recycle Bin?

Name three things you need to access the Internet?

Describe each of the following common types of Inter services:

Dial-up

DSL

Cable

Satellite

3G and 4G

What are some things you should consider when you are choosing and Internet Service Provider?

What is a modem?

What is a router?

What is a network card?

What does Wi-Fi stand for?

What is a web browser and what is its main job?

What is the World Wide Web?

Name three different types of web browsers?

Explain the following security terms:

SSID:

Encryption password

Encryption

Passphrase

What steps do you need to take to keep your computer healthy?

How do you deal with spilled liquid on your keyboard?

How do you clean the mouse and the monitor?

What is malware and what does it include? What is the best way to guard against malware?

In what ways can you back up your computer?

Name several techniques to maintain your computer?

Define computer ergonomics.

What are four general tips to keep in mind when troubleshooting your computer?

What is a flash drive?

What is Cloud storage?

What is the proper way to safely remove a flash drive from the computer?

Name three free popular services that allow you to save data to the Cloud?

What are accessibility features? Name three?

Name three assistive technology devices and what they are used for?

Answers

Answer:

Software for personal computers is typically developed and distributed independently from the hardware or operating system manufacturers. Many personal computer users no longer need to write their own programs to make any use of a personal computer, although end-user programming is still feasible. This contrasts with mobile systems, where software is often only available through a manufacturer-supported channel. And end-user program development may be discouraged by lack of support by the manufacturer.

Explanation:

How do I retrieve the number from an old home phone? Someone called my home phone (it is not a cellular phone) and they did not leave their phone number. Any advice welcome.

Answers

Answer: Use recent Callers function

Explanation:

Now all home phones have different ways of getting there, but should you see a settings, or functions button, or even a button that looks out of place in the middle of the phone right underneath the screen, that is the button that you will select. Go through the options available and you will see a option called "Recent Callers" and there you will be able to find all the recent callers whom called your home phone.

Which tool adds different amazing effects to a picture.

(a) Paint

(b) Lines tool

(c) Magic tool​

Answers

Answer:

magic tool

Explanation:

write a valid HTML + Python page that will count numbered from 1 to 1,000,000?​

Answers

Answer:

I remember before the corona virus we used to do math at school

Debug the code in the main method of this class, which is intended to initialize an array named arr to hold 3 ints, fill this with 3 inputs from the user, then print the contents of the array in order followed by the sum.
Here's the code that needs to be fixed:

import java.util.Scanner;

public class U6_L1_Activity_One{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int[] arr = new int(3);
arr[1] = scan.nextInt();
arr[2] = scan.nextInt();
arr[3] = scan.nextInt;
System.out.println("Contents: " + arr{1} + " " + arr{2} + " " + arr{3});
System.out.println("Sum: " + arr[1] + arr[2] + arr[3]);
}
}

Answers

Answer:

import java.util.Scanner;

public class U6_L1_Activity_One{

 public static void main(String[] args){

   Scanner scan = new Scanner(System.in);

   int[] arr = new int[4];

   arr[1] = scan.nextInt();

   arr[2] = scan.nextInt();

   arr[3] = scan.nextInt();

   System.out.println("Contents: " + arr[1] + " " + arr[2] + " " + arr[3]);

   int Sum = (1 + 2 + 3);

   System.out.println("Sum: " + Sum);

 }

}

Explanation:

Debugging a code involves locating and correcting the errors in the code.

The errors in the code are:

Invalid array declaration and indexingImproper usage of the scanner objectIncorrect syntax of sum

So, the corrected code segment is as follows:

        int [] arr = new int[3];

       arr[0] = scan.nextInt();

       arr[1] = scan.nextInt();

       arr[2] = scan.nextInt();

       System.out.println("Contents: " + arr[0] + " " + arr[1] + " " + arr[2]);

       System.out.println("Sum: " + (arr[0] + arr[1] + arr[2]));

Read more about debugging at:

https://brainly.com/question/18844825

What is the top anime shows? <3

Answers

Answer:

This is personally based on my opinion.

My top 10 favorites

Toradora

Darling in the franxx

Lucky Star

My Melody

Death note

Attack on titans

One piece

The Promise neverland

Kaguya-sama: love is war

Black cover

Answer:

This is just my opinions as of rn

Explanation:

Attack on Titan

Hunter x Hunter

Saiki K

Haikyu!!

The Promised Neverland

Toilet Bound Hanako-kun (The manga is amazing.)

Ouran High School Host Club

Given

Yuri on Ice!!!

Hetalia

some close runner ups were

Toradora

A Silent Voice

Anohana

Kakegurui

and Black Butler

The other anime i've seen were either movies and shows I watched as a kid or I just couldn't think of them right away

please help me please help me​

Answers

Explanation:

in C++

#include<iostream.h>

#using namespace std;

main()

{

int array[8];

int oddSum=0;

for(int i=0; i<8;i++)

{

if(array[i]%2==1)

{

oddSum=oddSum+array[i];

}

else()

{ //do nothing }

}

cout<<"The sum of odd numbers are:"<<oddSum;

getch();

return 0;

}

What is the value in y2 when the code show below executes?
x1 = [ 5 3 1 7 9]; [y1 y2] = min(x1)

Answers

Answer:

y2 = 3

Explanation:

This question needs us to give the value of y2 when we run this code in the question.

By min(X1) it is asking for the minimum value in the list of values that we have in the question.

Y1 is the first minimum value in the list and it is = 1

Our answer of interest in this solution is to, which is the second minimum value in the list after Y1

Therefore y2 = 3

Thank you!

Sonja is writing a program to compare two numbers and print the larger number. Which of these should be used?
a while loop
if and else
if, elif, and else
a string variable

Answers

Answer:

if and else

Explanation:

if (num1 > num2):

   print(num1)

else:

   print(num2)

Cards in a pack are black or red in the ratio
black: red = 2 : 5
What fraction of the cards are red?​

Answers

Answer:

[tex]Fraction = \frac{5}{7}[/tex]

Explanation:

Given

[tex]black: red = 2 : 5[/tex]

Required

Determine the fraction of red

First, we calculate the total ratio.

[tex]Total = black + red[/tex]

Substitute values for black and red

[tex]Total = 2 + 5[/tex]

[tex]Total = 7[/tex]

The fraction of red is then calculated as:

[tex]Fraction = \frac{Red}{Total}[/tex]

[tex]Fraction = \frac{5}{7}[/tex]


Victor has an Excel workbook that contains a macro. What is the appropriate file type to save the workbook in?
xlsx
xitx
xlsm
xlx

Answers

Answer:

xlsm

Explanation:

Generally, workbooks are known as Microsoft Excel files. Excel workbook can be defined as a collection of one or more charts and worksheets (spreadsheets) used for data entry and storage in an excel file. In order to create a project on Excel you will have to use a workbook.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer software applications such as Microsoft Excel.

The Microsoft developers has made it easy for their users to automate the tasks used frequently through the creation and execution of macros.

Basically, macros comprises of commands and instructions which may be grouped together as a single command to automatically execute a task.

In this scenario, Victor has an Excel workbook that contains a macro. Thus, the appropriate file type to save the workbook in is the xlsm extension (format).

Which of the following is true of operations within a spreadsheet program’s built-in functions?
Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.
Operations within parentheses, then addition and subtraction, and then multiplication and division are computed.
Multiplication and division, then addition and subtraction, and then operations within parentheses are computed.
Addition and subtraction, then multiplication and division, and then operations within parentheses are computed

A. Operations within parentheses, then multiplication and division, and then addition and subtraction are computed.

Answers

Answer:

a is the answer

Explanation:

What will be the output of the following code?
#include
void fun(int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n>0)
{
fun(--n);
printf("\n%d",n);
fun(--n);
}
}

Answers

Answer:

The output is 0, 1, 2, 0

Explanation:

The C source code defines a void function called 'fun'. The fun function is a recursive function that is used to recursively count through a number excluding the last number, the function accepts an integer value to be counted.

Answer:

to be honest I don't know

where do you access to header section in excel?​

Answers

Answer:

On the Insert tab, in the Text group, click Header & Footer. Excel displays the worksheet in Page Layout view. Click the left, center, or right header or footer text box at the top or the bottom of the worksheet page.

Explanation:

1. What is the primary tool that Windows Server administrators use to create and manage user accounts

Answers

Answer to you questions is: Active Directory

When adding color to an html document, you can use the color name or
the color number
Choose
False
True

Answers

Answer:

True

Explanation:

your teacher has accidentally put the wrong names of the students on her excel science results sheet. What method can be used to change the names to the correct names why is it better to do these result sheet on the computer rather than on paper answer by brainly​

Answers

Answer:

Explanation:

Excel has a built-in function that allows you to type in a word, letter, or number and it will automatically find every one of that entry and replace it with whatever you want. To do this you simply click on Home > Find & Select > Replace and fill out the information. Once the info is completed click Replace All. This shows exactly why it is way better to do these result sheets on the computer as opposed to on a piece of paper, it allows you to automate everything and fix multiple mistakes with a simple button click.

An algorithm is Group of answer choices The part of the computer that does the processing A complete computer program The inputs and outputs of a program A finite set of steps to solve a problem

Answers

Answer:

A finite set of steps to solve a problem

Explanation:

From the list of given options, option D describes an algorithm

Other options such as:

(A) describes the CPU of a computer;

(B) describes a written program which is achieved with the use of one or more programming languages

and (C) which describes the data that is being supplied into the program and also the information expected from the program.

Hence:

(D) is correct

Which option is used to ensure the integrity and authenticity of a Word document but requires additional services to be available on the internal network? digital encryption digital signature password protection protected view

Answers

Answer:

Digital signature.

Explanation:

Digital signature is used to ensure the integrity and authenticity of a Word document but requires additional services to be available on the internal network.

This is important as it makes sure that the file is authentic and not malware.

Answer:

digital signature

Explanation:

got it right on edge

Name and define two ways an IDS connects to a network.

Answers

Answer:

The two ways an IDS connects to a network are:

1. Signature-based detection uses patterns by establishing a unique identifier for the detection of future cyber attacks, using the IDS sensors and consoles.

2. Statistical anomaly-based detection, as an expert system, relies on the identification of anomalies in the network traffic by comparing against established baselines.

Explanation:

Organizations use the Intrusion Detection System (IDS) as a software program to detect a computer network attack in an effort to stop the attack.  The program analyzes the network traffic for signatures of known cyberattacks and the delivery of network packets.  There are two types: NIDS and HIDS.  Whereas a Network Intrusion Detection System (NIDS) is designed to support multiple hosts, a Host Intrusion Detection System (HIDS) is set up to detect illegal cyber actions in a host's operating system files.

What are some of the issues that create conflict in the future and why?

Answers

Answer:

Some of the reasons for future conflict between nations could be:

Explanation:

1: water wars, this is something possibly brewing between Ethiopia and Egypt with Sudan being on Ethiopia's side as the dam Ethiopia plans to build which would take a lot of Egypt's water would also power Sudan with electricity. Oh and something frightening could happen as China is damming India's major rivers which could lead to a world war or India becoming a Chinese vassal and massive amounts of displaced and starving people either way.

2: a global economic drop: this will severely impact the economies of many countries, especially countries in the middle of industrialization in Africa which are very fragile, I will give it a few decades to fully blow up there.

3:Competing interests, ethnic and international for example in Central Asia there are a lot of competing influences and something could happen there but thing is wars because of what I just mentioned are already happening, look at Syria with the "moderate" rebels, between Armenia and Azerbaijan we have had a conflict which had several geopolitical implications and reasons it went as it did, currently Libya is in a proxy war too, and recently Ethiopia has had conflicts within a Northern region which are heavily ethnic-based and could lead to an Ethiopian civil war if the government does not manage to solve this, which would also mean the first war I mentioned would be delayed or prevented trough another bloody war.

4: an incident: many wars have started because of incidents escalating, so watch out for it, for example earlier this yea- oh it's been a year already since Qasem Soleimani was assasinated , however luckily nothing happened then.

Either way we're gonna have more wars before world peace and mercenaries are becoming more popular like Turkey and more countries are using in proxy wars and another thing you should watch out for is the first use of robots in war and hope that they distinguish between regular humans and soldiers and don't commit atrocities, happy 2021!

How many total cells can a worksheet window contain? If columns are labelled alphabetically, what will be the label for the cell in row 1, column 16,384?

Answers

Answer:

[tex]5815 {20 \frac{55}{ \\ hii \: \\ \\ } }^{?} [/tex]

Think about the ways new communication technologies can make certain tasks easier for
users with disabilities. For two categories of individuals with disabilities (e.g., the blind,
deaf, restricted mobility, etc.), explain one way that everyday technology helps them.
Describe the specific way the technology improves their lives.

Answers

Technology gives them the ability to do things that they normally couldn’t do. Like deaf people could get a cochlear implant to make them hear, people without a leg can get a prothetic leg to help them walk. Even something as simple of being colorblind, there are glasses to help them see color. It’s amazing.

Where are functions stored?

in the development environment or on the Internet

in the development environment or in an individual program

in an individual program or on a computer’s hard drive

in an individual program or in a lookup table

Answers

Answer:

In the development environment or in an individual program

Explanation:

A function in programming is a code or lines of code that perform a particular function.

They are stored in the development environment or in an individual program so they can be called up and execute when needed.

When is historical data not useful

Answers

Answer:

to address for setting cost increase of a resource to determine the amount of money needed for a future project to plan for future years operation costs to predict sales based on past growth

Other Questions
It was on a Christmas Day, 25th December, when my father had a call onyou at the Sakasaka Police Station right away. It is very urgent" and theother end asked. "Yes, Mr. Tonto speaking, my father replied. "We need you at the Sakasaka police station right away.It is very urgent" and the line dropped dead.We got on the car and within ten minutes we were at Sakasaka. We were,however, shocked to our bones when we saw my elder brother andWe were all troubled. My father went for his car keys, and told us to gomentor put behind bars. Nobody understood how and why he was there All of a sudden, a police officer arrived and asked, Is this your son?and my father replied, yes he is. The officer continued, "We foundcocaine in his shop and he is still denying ownership. My father wasshocked. The officer showed us the substance. Meanwhile my brotherwas bitterly crying his heart out in the cell.We told the officer he was innocent and he asked us if we could proveMy father went into the car and brought out a machine, scannedbrother's fingers and the finger prints on the substance. They concludedthey were not my brother's; in fact they do not match. My brotherthus, exonerated and freed.Summrize the passage in 5 sentence Scientists were examining the maize genome. They had two specimens: one control and one specimen that had undergone mutagenesis. They saw that the mutant specimen underwent a knockout caused by a nucleotide exchange in the DNA. When they compared gene sequences, they saw same number of nucleotide bases. Which type of mutation had most likely occurred? deletion insertion inversion substitution what is light? of science 2. What does a lyric poem lack or not have that is useful for finding the theme?a titlea settinga plotcomplete sentences can someone help me please. thanks! 50 points PLEASE HELPWrite an ArgumentYou will be writing an argument essay about a topic of your choice. Your teacher will score your final draft.Use the steps described here to complete your assignment.Directions Choose one of the suggested topics, or use a topic of your own. Decide what your position is on the topic. In your introduction, make a clear, precisely worded claim that expresses your stance on the issue. Support your claim with reasons and evidence. Acknowledge counterclaims and address them. Write a conclusion that sums up your major points. Your writing should be about 250 words long. What does the first T in TPCAST stand for?a. Toneb. TextC. Themed. Title PLSSSSSSS HELP ME I DON'T KNOW WHAT TO DO if perimeter and length of a rectanguar field are 154m and 42m respectively, find its breadth Anybody willing to drop an assist? PLZ HALP! I'm pretty sure the answer is A, but I just wanna double check! Plz help not much time left Why is society sympathetic towards cancer patients but not patients who have HIV?? How was WWI a "War of Full Loss"? The pyramid has a base that is a righttriangle with side lengths 3 feet , 4 feef , 5 feet .its height is 6 feet. What is the volume of the pyramid? Suppose 275 g of NO3- flows into a swamp each day. What volume of CO2 would be produced each day at 17.0C and 1.00 atm? I attached the image of the equation for reference who is the president of the United States Someone help me please and thank you!! ASAP :( Add (x + 4) + (3x + 2). I WILL MARK BRAINLIST! can i have some help