Question

USE PYTHON ONLY. AND USE DEF FUNCTION. thank you
media%2F77d%2F77df85e8-b213-407d-92ea-fb

Question 54 States Write a program that displays the nameof the states in the list NE in decending order by population.

NE = [("Maine" , 30840, 1.329) , ("Vermont" , 9217, .626), ("Massachusetts" , 7800, 6.646), ("Connecticut" , 4842, 3.59), ("Rhode Island" , 1044, 1.5)]

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def stateByTop(n):
    states = NE()
    for i in range(0,len(states)):
        madeSwap = False
        for j in range (0,len(states)-(i+1)):
            if states[j][2] < states[j+1][2]:
                temp = states[j+1]
                states[j+1] = states[j]
                states[j] = temp
                madeSwap = True
        if not madeSwap:
            return states
    return states[n]
Add a comment
Know the answer?
Add Answer to:
USE PYTHON ONLY. AND USE DEF FUNCTION. thank you Question 54 States Write a program that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C# windows forms program to create a States and Capitals guessing game. A method...

    Write a C# windows forms program to create a States and Capitals guessing game. A method in your program should generate a random number between 1 and 50. Your program should use this number to represent one of the 50 U.S states and then display the name of that state. The user will guess the capital of that state. Another method in your program should get the users answer and check to see whether it is correct. Yet another method...

  • I am trying to do this assignment: Write a program that reads a list of concepts/strings...

    I am trying to do this assignment: Write a program that reads a list of concepts/strings from the LIST.txt text file (one concept per line), stores them into an array of strings, and then prints the following: 1.Prints a heading “LIST1:” and then prints all the concepts from the array, one concept per line 2.Prints a heading “LIST2:” and then prints all the concepts from the array that do not contain spaces, one concept per line 3.Prints a heading “LIST3:”...

  • Please Help!(Write a C++ program Only):- The attached file has a number of records giving US...

    Please Help!(Write a C++ program Only):- The attached file has a number of records giving US state names, populations, and number of Federal electors. The fields are delimited by spaces. The first field is a single integer giving the number of states that follow. Guidelines:- 1)Read the first integer and use it to allocate dynamic arrays to contain the state name and the state population. 2) Read in the population data. The electors field is not used. 3) Calculate the...

  • 26. (For this question use the data file Per Capita Link). A researcher interested in examining...

    26. (For this question use the data file Per Capita Link). A researcher interested in examining how a state's per capita income may be affected by the percent of the state's adult population that has not completed high school and the percent of the state's population that is foreign bom. part a: Write down an appropriate model for this researcher to estimate. Clearly identify what is the response variable and what are the explanatory variables. part b: Using regression analysis,...

  • Please write answers clear. I will leave like if its correct. State POVERTY% GUN DEATHS H.S. GRAD's UNEMPLOYMENT New Jersey 6.80% 5.7 91.8 91.8 Vermont 7.60%...

    Please write answers clear. I will leave like if its correct. State POVERTY% GUN DEATHS H.S. GRAD's UNEMPLOYMENT New Jersey 6.80% 5.7 91.8 91.8 Vermont 7.60% 9.2 91 3.6 91 3.6 Minnesota 8.10% 12 91.5 4 Hawaii 8.60% 2.6 87.4 4.9 Delaware 9.20% 10.3 90.4 3.7 Utah 9.20% 12.6 90.4 3.7 Virginia 9.20% 10.2 86.6 4.5 Nebraska 9.50% 9 89.8 2.8 connecticut 9.70% 4.4 88.6 5.3 Maryland 9.70% 9.7 88.2 5.1 Idaho Alaska 9.90% 10.00% 14.1 17.6 88.4 91.4 4.2...

  • 1.1 Fuel Economy. (mpg) of model year 2016 motor vehicles Here is a small part of a data set that...

    1.1 Fuel Economy. (mpg) of model year 2016 motor vehicles Here is a small part of a data set that describes the fuel economy in miles per gallon Make and Vehicle Class Transmission Number of City Highway Annual Fuel Model Type Cylinders mpg mpg Cost Subaru Im Compact preza Nissan Juke Small station Manual Manual 4 25 34 $900 4 28 34 1,100 wagon Midsize Hyundai Elantra GT Automatic 24 $950 19 Chevrolet Im Large pala Automatic 29 1,150 The...

  • JAVA Create a Governor class with the following attributes: name : String party - char (the...

    JAVA Create a Governor class with the following attributes: name : String party - char (the character will be either D, R or I) ageWhenElected : int Create a State class with the following attributes: name : String abbreviation : String population : long governor : Governor Your classes will have all setters, getters, typical methods to this point (equals(), toString()) and at least 3 constructors (1 must be the default, 1 must be the copy). You will be turning...

  • I need help with this question. I need a supporting paragraph. Following are results from three...

    I need help with this question. I need a supporting paragraph. Following are results from three hypothetical corporate tax returns. Each purports to be a list of expenditures, in dollars, that the corporation is claiming as deductions. Two of the three are genuine, and one is a fraud. Which one is the fraud? Write at least 6 complete sentences explaining why you think your chosen return is a fraud. 17 ORE 80.535 3.037 132.056 59.727 38.154 137.648 79.386 203.374 11.967...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT