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'. I am stuck on this python assignment. Don't need the answer asap, just some explaining of how to write code to do that. I know about the built in sort function

Answers

Answer 1

Answer:

Read the file and save it to a variable as a string, split the string variable and cast it to a set object using the set function to get the unique words in the file. Then use the max function with the key attribute to use regular expression module "re" to compare the first letter of each item to return in a list comprehension or append to a list.

Explanation:

The open function is used to import a file in python, the split string method splits the string to a list of items and the set function removes any duplicates of a word or item.

Using the for loop statement, iterate over the items and compare and return the items in alphabetical order with the 're' search method getting the item with uppercase letters with higher precedence than lowercase.


Related Questions

Which tab in MS Word would you select to insert a shape into a document? Question 6 options: Insert Review View File

Answers

Answer:

Insert

Explanation:

Under the insert tab, shapes will be an option to put in under the illustrations category.

Answer:

um insert?

Explanation:

im assuming its insert bc you said "to insert a shape into a document" so yh

i hope this helped?

Assume that x and y are boolean variables and have been properly initialized. !(x || y) || (x || y) The result of evaluating the expression above is best described as:

Answers

Answer:

The answer is "Always true "

Explanation:

Following are the program to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

bool x=true;//defining bool variable x and assign value

bool y=false;//defining bool variable y and assign value

if(!(x || y) || (x || y))//use given condition with if block

{

   cout<<"True";//print true message

}

else//defining else block

{

   cout<<"false";//print false message

}

   return 0;

}

In the above code two bool variable is declared, that hold ture and false, and used in the given expression with the condition statement, that checks the given value. In the code the logical gate OR gate that always print the true value.

what is wrong with this picture?????

Answers

“you got a tight little-“

uhm y’know everything is wrong with it terrifying really is uhm but yeah.

oh god that leg tho

(Java)Write a program that calculates and displays the conversion of an entered number of dollars into currency denominations—20s, 10s, 5s, and 1s. Example output: $452 converted is 22 $20s, 1 $10s, 0 $5s, and 2 $1s.​

Answers

Answer:

Below!

Explanation:

This is the code I have. I am not sure what I am missing that it won't accept -  

import java.util.Scanner;

class Dollars {

   public static void main(String[] args) {

            int numTwenties,numTens,numFives,numOnes,dollarAmount;  

       Scanner sc= new Scanner(System.in);

       System.out.println("Please enter a dollar amount: ");  

       dollarAmount = sc.nextInt();

        numTwenties = dollarAmount/20;

        numTens = (dollarAmount - 20*numTwenties)/10;

        numFives = (dollarAmount - (10*numTens + 20*numTwenties))/5;

        numOnes = (dollarAmount - (10*numTens + 20*numTwenties + 5*numFives));

       System.out.println(+ dollarAmount + " converted is" + numTwenties + " $20s, " + numTens + " $10s, " + numFives + " $5s, and " + numOnes + " $1s.");  

   }

}

This is what it is giving me -

Test CaseIncomplete

Dollars 598

Input598

OutputPlease enter a dollar amount: 598

598 converted is29 $20s, 1 $10s, 1 $5s, and 3 $1s.

Results

$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s

Expected Output

$598 converted is 29 $20s, 1 $10s, 1 $5s, and 3 $1s

It's mainly the price measure with one currency against the other, even as rate changes, money through one country can get relatively weak or powerful in comparison with the other currencies, and the further program can be defined as follows:

Program Explanation:

Import package.Defining a class Conversion .Defining an integer variable "twenties, tens, fives, ones, amount, n".After defining a variable, a Scanner class object is declared that inputs value in it.In the next step, a conditional statement is declared that checks value and hold its calcuated value.At the last, a print method is declared that prints its value.

Program:

import java.util.*;//import package  

public class Conversion //defining a class Conversion

{

   public static void main(String ar[])//defining a main method

   {

       int twenties, tens, fives, ones, amount, n;//defining an integer variable

       Scanner obcdf= new Scanner(System.in);//creating Scanner class object to input value

       System.out.println("Enter amount: ");//print message

       amount = obcdf.nextInt(); //input integer value

       n =  amount; //holding innput value

       if(amount > 20)//using if block that check amount value greater than 20

       {

           twenties = (int)(amount/20); //using twenties that divides amount value by 20 and hold its integer value  

           amount = amount % 20;// holding modules value in amount variable

       }

       else  //defining else block

       {

           twenties = 0;//holding 0 in twenties variable  

       }

       if(amount > 10)//using if that check amount value greater than 10

       {

           tens = (int)(amount/10);//using tens that divides amount value by 10 and hold its integer value

           amount = amount % 10;// holding modules value in amount variable

       }

       else  //defining else block

       {

           tens = 0;//holding 0 in tens variable  

       }

       if(amount > 5)//using if that check amount value greater than 5

       {

           fives = (int)(amount/5);//using tens that divides amount value by 5 and hold its integer value

           amount = amount % 5;// holding modules value in amount variable

       }

       else //defining else block

       {

           fives = 0;//holding 0 in fives variable  

       }

       if(amount > 1)//using if that check amount value greater than 1

       {

           ones = (int) amount;//holding amount value in ones variable

       }

       else //defining else block

       {

           ones = 0;//holding 0 in ones variable

       }  

       System.out.println("$"+n+" converted is "+twenties+" $20s, "+tens+" $10s, "+fives+" $5s, and "+ones+" $1s."); //print value

   }

}

Output:

Please find the attached file.

Learn more:

brainly.com/question/4448370

computer network reduces the cost of operation​

Answers

Answer:

Computer Networks can allow businesses to reduce expenses and improve efficiency by sharing data and common equipment, such as printers, among many different computers. At the same time, the network may be connected by cables, telephone lines, infrared beams etc, which is cheaper and helps to reduce the expenses.Explanation:

Which strategies for effective presentations is Ian using in his opening? Check all that apply.
using a hook in his opening
detailing the speech’s objectives
communicating all the major details of the speech
engaging with his audience by asking them questions
letting his audience know what to expect

Answers

Answer:

A. using a hook in his opening

B.  detailing the speech’s objectives

E. letting his audience know what to expect

Explanation:

Opening his speech using a quotation is a strategy of using a narrative hook, or simply hook, by Ian. Giving a grand and enticing opening is what makes an audience to pay attention and listen to what the speaker has to say in his speech. So, first strategy used by Ian is using a hook in his opening.

Another strategy used by Ian is giving objective details of his speech. By outlining what he will be covering in his speech, Ian is letting his audience know what to expect from the speaker and his speech, and also gave details of his speech.

So, option A, B, and E are correct.

Answer:

A, B , E !

Explanation:

Kali, a Python programmer, is using the turtle module to write the word “hello.” Which code should she use to indicate the location to begin writing the word?

Answers

Answer:

c

Explanation:

what does good time management mean​

Answers

Answer:

When you are consistent with your work and not wasting time

Explanation:

Time management to me means using your time wisely and thing you have to get done do those things first before doing something that is not a must. Being wise with your time will help you complete goals and more in life.

Have a good day and a merry Christmas

Which of these statements about tags is false?
Group of answer choices

Their font is center-aligned by default.

They serve as the label for a row or column.

They automatically display as the first row or column.

Their font is bold by default.

Answers

Answer:

LOL i don't even know

Explanation:

A CD and a DVD are both secondary storage devices, explain to a friend the difference between both​

Answers

Answer:

i dont have any friends to explain it to

Explanation:

A student who might find digital learning challenging.

Answers

Digital learning exists mostly online, while traditional learning takes place in a classroom building.

Answer: it is "A"

|Likes meeting other students.|

Kerri is adding text and graphics to her presentation. She does this work in the _____. Normal (Slide) view Task pane Formatting toolbar Slide Sorter

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is Normal View.

Kerri can add text and graphics to her presentation. She does this work easily in the Normal view of the slides. In normal view, you can edit your slide by slide and navigate with the thumbnail.

while other options are not correct because:

Task pan is used to show information about the current slide.

Formatting toolbar is used for formatting the contents in the slide

Slide sorter is a view that is used to see the thumbnail of all slides in your presentation to easily rearrange them.

Which is the most recent version of Microsoft Windows?


Windows 10


Windows NT


Windows Service Pack 2


Windows Longhorn

Answers

Answer:

Windows 10

Explanation:

Answer:

Windows 10

Explanation:

Windows 10 was released in 2015 while other are old

Fill in the blanks : To store 3 character a computer occupies...................bytes memory space​

Answers

Answer:

Umm was there supposed to be a picture????

Explanation:

Hope you have a wonderful Christmas Eve time with your family!!❄️

Eight bits are called a byte. One byte character sets can contain 256 characters. The current standard, though, is Unicode, which uses two bytes to represent all characters in all writing systems in the world in a single set.

What is memory space?

Memory refers to the location of short-term data, while storage refers to the location of data stored on a long-term basis. Memory is the power of the brain to recall experiences or information.

Memory is most often referred to as the primary storage on a computer, such as RAM. Memory is also where information is processed. It enables users to access data that is stored for a short time.

Learn more about Memory here,

https://brainly.com/question/23423029

#SPJ2

What is a frame injection attack in a wireless network?

A. A hacker inserts a forged frame during data transmission.

B. A hacker creates a botnet to flood a particular website.

C. A hacker sniffs data packets from a data transmission.

D. A hacker deletes frames during a data transmission.

The answer is A.

Answers

Answer:

A.Un hacker introduce un cadru fals în timpul transmiterii datelor.

Explanation:

A - a hacker inserts a forged frame during data transmissions

help plz (will give brainliest)

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This is the python program in the question that is:

def sum(n1,n2):

n=n1+n2

return n

The question is: write a function CALL that displays the return value on the screen.

So, the correct program is written below:

*********************************************************************  

def sum(n1,n2):# it is function that define sum

 n=n1+n2 # variable n that store the result of n1 and n2

 return n # return the result

print(sum(3,5))# call the sum function with parameter 3 and 5 , it will print 8

print(sum(4,101))

# call the sum function with parameter 4 and 101 it will print 105

********************************************************************************

you can also store the sum result into another variable, because this function return the sum. So, you can store that return value into another vairable and using the print function, to print the value of this variable such as:

*****************************************************************************

def sum(n1,n2):# it is function that define sum

n=n1+n2 # variable n that store the result of n1 and n2

return n # return the result

result= sum(6,9) # store the sum result into another variable i.e result

print(result)# print the result variable value

*****************************************************************************

why is it important to have a price assiociated in every product​

Answers

Answer:

The wrong price can also negatively influence sales and cash flow. tbh there is no point to me  

Explanation:

Answer:

Price is important to marketers because it represents marketers' assessment of the value customers see in the product or service and are willing to pay for a product or service. ... Both a price that is too high and one that is too low can limit growth. The wrong price can also negatively influence sales and cash flow.

Explanation:

What is the first thing animators need to determine when beginning a project?



a Editing locations



b Length of the film or project



c Setting



d Characters

Answers

Answer:c

Explanation:

BRAINLIEST!!! HELP!!! 20 PNTS!!

Which is the correct way to add a border color?

A. border-color(red);

B. border-color: red;

C. red: border-color;

D. border-color = red;

Answers

Answer:

The answer you are looking for is "B.) border-color: red"

HTML and CSS coding is fairly simple, but to assign a border color to a certain tag, you would write

Tag Name (without <>'s)

{

border-color: red

}

Remember that your border color will affect all of the tags mentioned in this command.

Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
questions
Online Content Site 1
Why isn't a good idea to study in bed?

Answers

Answer:

yes.. it is not good.

Explanation:

because its can calm our mindy & sleep quickly.

Answer:

I think avoiding stress and something/ anything disturbing your health is an effective conflict. In my opinion avoiding stress and anything disturbing your health is bad because the more time you ignore it the worse it get's.

Explanation:

I got it right on Edg.

Proof:

How do graphic designers showcase their work?
Graphic designers create(Blank)
to showcase their work.


THIS IS A BIG TEST IM BEHIND AND CANNOT FAIL PLZ

Answers

Answer:

Platforms!

Explanation:

Answer:

portfolios

Explanation:

A portfolio is a collection of work done by a graphic designer. Graphic designers use them to display their work to their clients.

2. Media sharing websites let you post photos and videos to share with other people. What are the benefits and drawbacks of using these websites?

Answers

Media sharing websites let you post photos and videos to share with other people. The benefit is that we are up to date and get all the news as well as information worldwide.

What is company's website?

The website of the company is all web sites which is operated by any occupied company or via any occupied company conducts the business. Any business website is a website that is designed in such a way that it can represent the identity of a business on the internet.

Company's name and fame id totally depends upon advertisement and its products and websites play an important role in order to make company popular and due to this reason company used the website or designed the website in unique and knowledgeable manner.

Therefore, Media sharing websites let you post photos and videos to share with other people. The benefit is that we are up to date and get all the news as well as information worldwide.

Learn more about website here:

https://brainly.com/question/19459381

#SPJ2

Define watcher block

Answers

Answer:

Happens when you are watching a series / film / drama / etc. but can not retain the attention span to watch for long periods of time. As well as the shortened viewing time, the ability to retain what has been viewed is impaired.

Explanation:

The Block Watcher puts the power of a microprocessor to work analyzing the current feed to the rails. This detector has been designed to eliminate many of the installation problems associated with the installation of signal systems. ... Then connect the detector output switch to your signal system.

Noodletools is one of the Online databases available at the BLA library
website. I can print a copy and/or export a copy of my citations from
Noodletools.
True
False

Answers

Answer: true

Explanation:

Select the correct answer
Which filter enhances the color contrast around the edges of an image?

A. Texture filters

B.Sharpen filters

C.Blur filters

D.Noise filters

Answers

Answer: C. Blur filters

Explanation:

The unsharp mask filters or blur filters can be used for professional color correction. This will adjust the contrast of the image. Edge details and may produce a darker and lighter line on all side of the edges. This helps in creating illusion or blur image giving a sharp contrast and sharper image.

So, the color answer C. Blur filters

Answer:

B, Sharpen Filters

Explanation:

i got it right lol

Can someone help me get spotify premium

Answers

Answer:

Yes just go to spotify and pay for spotify premium.

Explanation:

Answer:

Buy it, go to the app store or google play and it will surely pop up like a sign saying premium.

Explanation:This is so hard :/

ILL GIVE BRAINLIEST HELLP.
in windows 8, the _____ manager is the app that allows you to manage your hardware drivers on your computer .
a. device
b. drivers
c.system
d.utilities

Answers

Answer:

Device Manager

Explanation:

The Device Manager is used to check for hardware that have been installed on your system such as RAM, CPU, GPU etc. However, it has the option to update drivers for any hardware that you such desire.


A programmer has a need to round many numeric values to the nearest integer. Which of the following best explains the benefit of using a list as a data abstraction in this situation

Answers

Answer:

Keeping the numeric values in a list makes it easier to apply the same computation to every data element.

Explanation:

A list or array in programming is a data structure, that has the location for each item it holds indexed. It eliminates the need to constantly create a variable to compute items of the same data types.

The list can store items of the same data type and iterate over them to compute the same calculation on each of them.

Lists are values which are seperated by commas and populated within square brackets. They are mutable and values could be easily accessed, appended, deleted or replaced. Hence, the use of a list for data abstraction is beneficial in that the round function could be easily applied to all the values in the list.

Rounding the values in the list coukd be easily done using for loop which takes each value in the list one at a time, rounds them to the nearest integer and places them into another list.

Using the a python list comprehension thus:

Given a list of numeric Values :

my_list = [1.2, 1.4, 1.5, 1.7]

rounded_int = [round(x) for x in my_list]

Learn more : https://brainly.com/question/20533392

69.147.76.15 is an example of what?​

Answers

Answer:

IP address.

Explanation:

An IP address is an acronym for internet protocol address and it can be defined as a unique number assigned to a computer or other network devices, so as to differentiate each device from one another in an active network system. Thus, an IP address is typically used to uniquely identify each computer or network devices connected to the internet or network.

Hence, 69.147.76.15 is an example of an IP address.

In Computer networking, IP address are classified into two (2) main categories and these are;

1. Local (internal) IP address.

2. Global (external) IP address.

Generally, when this IP address such as 69.147.76.15 is translated by a domain name system (DNS), it is mapped to the domain name yahoo.com which is much more understandable or comprehensible to the end users.

What is the purpose of a div?
Group of answer choices

all of the above

to add a background color or image to a web page section

to change the styling of multiple contained elements

to group elements

Answers

Answer:

I'd choose A, all of the above.

Reasoning Why:

I'll be taking you on a step to step process on why I inputted the answer.

The <div>, is basically like a container that you can group tougher, why this is great is because you can edit the div using a background-color effecting that group such as the following..

EXAMPLE OF BACKGROUND-COLOR DIV (background-color)

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample{

background-color:red;

/*Example of the Background-color attrib*/

/*You can also use the background-image attrib, however I recommend you checkout W3Schools, on that topic.*/

}

</style>

</head>

<body>

<div id="byexample">

<p>Just some random text to demonstrate.</p>

</div>

</body>

</html>

END OF EXAMPLE

You can also, in the <div> change multiple styles of an element in the div. However, if do want to change the styles of a single element you would need to nest it.

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample #text{

background-color:red;

color:yellow;

}

</style>

</head>

<body>

<div id="byexample">

<p id="text">Just some random text to demonstrate.</p>

</div>

</body>

END OF EXAMPLE

Lastly, you can group elements using divs, as stated in openclassroom (website).

Anyways, I hope this helped!

Happy coding!

Other Questions
a g9al without plan is just a wish ? explain this statement Andrew makes $10 per hour babysitting and $8 per hour working at the grocery store. He will need to make atleast $650 to buy a new computer. Are the variables defined correctly? (True or False) x = Hours babysitting y = Hours working at grocery store A majority of the governments around the world currently use a federal system Find m. Leave answer in simplest radical form.130 The author of "TheTortoise and the Hair"is trying to teach us ______ Which of the following is not an a major issue that the Antifederalists disliked about the Constitution?Question 2 options:They felt that the convention in Philadelphia had overstepped their authority. There was a concern in giving the national government so much more powerThere was a concern that the government would not be able to maintain control of the statesMany people that felt that the Constitution did nothing to protect people's liberties/ rights Youngstown Rubber reports the following data for its first year of operation. Direct materials used $710,200 Direct Labor 350,000 Cost of goods manufactured 1,030,300 Finished goods inventory, ending 190,900 Finished goods inventory, beginning 0 Manufacturing overhead 100,100 Work in process inventory, beginning 0 Work in process inventory, ending 130,000 What are the total manufacturing costs to account for Evaluate the following functions to determine the range for each given domain. 3. f(x) = 5x + 6 D = {-3,0,5} 4. f(x) = -1 D = {-6,9,21}please show work A 782-kg satellite is in a circular orbit about Earth at a height above Earth equal to Earth's mean radius. (a) Find the satellite's orbital speed. 9.82278e7 Incorrect: Your answer is incorrect. Your response differs significantly from the correct answer. Rework your solution from the beginning and check each step carefully. m/s (b) Find the period of its revolution. h (c) Find the gravitational force acting on it. PLEASE HELP ME QUICK!!!!! For proportional percent problems, why do you put a 100 on the bottom of the right proportional ratio (fraction)? How was the rotation rate of Jupiter's core determined?-by observing the Great Red Spot-by watching lo move across the disk of Jupiter-by radio observations of Jupiter's rapidly spinning magnetosphere-by measuring the oblateness of Jupiter's disk How are coordinate planes the same ???? 22 points if u can answer Which set of ordered pairs does not represent a function? O {(-3,-9), (7,9), (9, 1), (7,3)} O {(-3,8),(-6,5), (-5, -6), (1,-6)} O {(3,1),(-2,-9), (6,-9),(4,6)} o {(4,3), (-4,4),(-2,-5), (6,4)} 30 POINTS BRAINLY FIRST REAL RESPONSE Step 3: Applying linear functionsGrace and Claires parents are saving money now for their college education. Function 1 shows the growth of baby Graces college fund over time. Function 2 shows growth of baby Claires college fund over time.a) If Grace and Claires parents each invested $7,600 into a college saving account when the girls were born, how much money will each girl have for college when she turns 18? Explain. (2 points) b) Do the functions show a positive or negative correlation between time and the amount of money saved? Explain. (1 point) 17. Write a rational function in expanded form that satisfies thefollowing criteria: V.A. x=2 SI.A y =5x-1 Zero of function (-1,0)pls help thank you What would you suggest as a strategy to reduce pollution globally? Implement policies to reduce fossil fuel emissions around the world. Monitor the volume of pollutants released from cars and other vehicles in Africa. Create pamphlets about air pollution health effects and distribute them to the Americas. Enforce strict regulations by fining industries that release air pollutants in Europe. A bag of coins contains only quarters and dimes. The number of dimes in the bag can be represented by x. The number of quarters is 6 more than twice the number of dimes. There are a total of 276 coins in the bag. What is x, the number of dimes in the bag?helpp pls find 59.2% of 250................................... If a 5-foot man casts a 6-foot shadow, how tall is a tree that casts a24-foot shadow? How can steroids benefit you? Can u write at least a paragraph which is high school level