Write code to print the name of each city

Assignment Help Python Programming
Reference no: EM132586574

Question 1 - Required
Code this question in a separate file. When your solution works, paste it into the "starter file" in the location for question 1.
The code provided assigns data to the following dictionary:

1. Create a DataFrame using ['name', 'sales', 'region'] as column headings:
2. Display the records in the DataFrame which have a value of sales that is more than 40000. Print the resulting DataFrame.
3. Display the records in the DataFrame arranged in alphabetical order by region, with sales in each region from highest to lowest. Print the resulting DataFrame.

Question 2 -Required.
You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 2.
This question uses the data file courses.csv which contains information about fall and spring enrollments for several courses.
1. Create a stacked bar chart showing the number of students enrolled in each course during both fall and spring semesters.
2. Include a legend, title, cyan and green colors, axis labels, and ticks as shown. The width of each bar is 0.3.
3. The largest y-tick value is based on calculating the maximum values for fall and spring enrollments, and spacing them in intervals of 100.
(Please do not use a Pandas DataFrame for this question, but rather, implement your solution using techniques for reading and interacting with CSV files.)

Question 3 -Optional. Answer any four of the six optional questions.
You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 3.
This question uses the data file courses.csv which contains information about fall and spring enrollments for several courses. The first line of the file is a header row. the file is here: courses.csv
Write code to open the file and calculate the total number of students enrolled in any course containing the word "Java" in its name during the Fall Semester. Use whatever file reading techniques you wish to solve the problem.

Question 4-Optional. Answer any four of the six optional questions.
You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 4.
Write a function compare_letters(word1, word2) that returns a string describing whether two words share the same letters in corresponding positions.
The function returns a new string where each character is a + if the corresponding characters in word1 and word2 are the same, and - if they are different. If the strings are of different lengths, the resulting string should contain a ? for each position of the longer string.
Examples:
Your code should work for the three different cases shown in the code in the starter file for question 4. Hint: Get the function to work for two words which have the same length first. Calculate the difference in lengths from both words and append that many "'?"'s to the result.

Question 5-Optional. Answer any four of the six optional questions.

You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 5.

1. Rewrite this code to use a list comprehension.
2. Write a loop to print the index of each item in the list, followed by the original price and price with sales tax.

Question 6-Optional. Answer any four of the six optional questions.

You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 6.
Consider the list of gadgets:
1. Write Python code to display each item followed by its price.
2. Calculate and print the average cost of all items. Hint: You may use the statistics module to compute the average or write code to do it yourself, but that's longer!

Question 7-Optional. Answer any four of the six optional questions.

You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for Question 7.
Consider the dictionary containing hotel prices in various cities:

1. Write code to print the name of each city followed its most expensive hotel price.
2. Write code to compute and print the city and most expensive hotel price from those included in the dictionary.

Question 8-Optional. Answer any four of the six optional questions.

You may wish to develop your solution in a separate file. When your solution works, paste it into the "starter file" in the location for question 8.
A short name is defined as the first letter of a person's first name followed by the first five letters of their last name, converted to upper case. If the last name has five or fewer letters, use the entire last name.)
1. Write a function shortname(name) to return a short name given a tuple containing a first name and last name.
2. Write a function print_short( name, short) to display the full name (first and last, separated by a space) formatted in a field of 20 spaces, followed by the word Shortname:and the corresponding short name.
Your code should work with the sample code provided in the starter file.

Attachment:- Assignment Question.rar

Reference no: EM132586574

Questions Cloud

What is the purpose of including the ph indicator phenol : What is the purpose of including the pH indicator phenol red in the medium?
How do plan to audit dunks closing procedures : How do you plan to audit Dunks's closing procedures? What potential errors would you be most interested in?described above could affect your risk assessment.
What is the selective agent in pea media : What is the selective agent in PEA media? How does it work?
Which bacteria develop antibiotic resistance : What are different ways by which bacteria develop antibiotic resistance?
Write code to print the name of each city : Create a DataFrame using ['name', 'sales', 'region'] as column headings - develop your solution in a separate file. When your solution works
Explain how organisms can develop resistance : Explain how organisms can develop resistance to chemical disinfectants?
Case study design-restate your general phenomena : Restate your general phenomena. Research question: Explain the "unique" case (or cases) you intend to research using this approach.
Will liabilities owing to and amounts receivable : Will liabilities owing to and amounts receivable from organisations within the group be eliminated in consolidation process? Why or why not?
Developed a life-threatening mrsa infection : You turn on a television and catch the end of an interview with a young patient who developed a life-threatening MRSA infection

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd