Questions
Problem 2 Write a function (call it by your first name e.g. abc_trim) that takes a...

Problem 2

Write a function (call it by your first name e.g. abc_trim) that takes a list as argument , modifies it by removing the first and last two elements, and returns the new modified list e.g. if we call the function as katline_trim([1,4,6,8,11, 15]), we should get [4,6,8]. (Hint: Look at how we refer to list elements by their index and also how we use a negative number as index. You can also use a loop with the len() method

NB: Include python code, please. use spider

In: Computer Science

Use the following information to create SQL commands to retrieve data from Henry Books database :...

Use the following information to create SQL commands to retrieve data from Henry Books database :

For each book, list the book code, book title, publisher code, and publisher name. Order the results by publisher name.
For each book published by Plume, list the book code, book title, and price.
List the book title, book code, and price of each book published by Plume that has a book price of at least $14.
List the book code, book title, and units on hand for each book in branch number 4.
List the book title for each book that has the type PSY and that is published by Jove Publications.
Find the book code and book title for each book located in branch number 2 and written by author 20.
Find the book title, author last name, and units on hand for each book in branch number 4.
Repeat Exercise 7, but this time list only paperback books.
Find the book code and book title for each book whose price is more than $10 or that was published in Boston.
Find the book code and book title for each book whose price is more than $10 and that was published in Boston.
Find the book code and book title for each book whose price is more than $10 but that was not published in Boston.

In: Computer Science

We have created an ArrayList of Person class. write a method called push that pushes all...

We have created an ArrayList of Person class. write a method called push that pushes all the people with the even length last name to the end of the ArrayList

Content of the ArrayList before push

[alex Bus, Mary Phillips, Nik Lambard, Rose Rodd, Esa khan, Jose Martinex, Nik Patte]

content of the ArrayList after the push method
[alex Bus, Nik Lambard, Nik Patte, Mary Phillips, Rose Rodd, Esa khan, Jose Martinex]

import java.util.*;
class Person
{
   private String name;
   private String last;
   public Person(String name, String last)
   {
     this.name = name;
     this.last = last;
   }
   public String getLast()
   {
     return last;
   }
   public String getFirst()
   {
     return name;
   }
   public String toString()
   {
     return name + " " + last;
   }
}

public class ArrayList
{
  public static void main(String[] args)
  {
    ArrayList<Person> list = new ArrayList<Person>();
     list.add(new Person ("alex","Bus"));
     list.add(new Person("Mary", "Phillips"));
     list.add(new Person("Nik", "Lambard") );
     list.add(new Person("Rose","Rodd"));
     list.add(new Person("Esa","khan"));
     list.add(new Person("Jose","Martinex"));
     list.add(new Person("Nik","Patte"));
     System.out.println(list);
     push(list);
     System.out.println(list);

  
  }
//this method pushes all the people with the even length last name to the end of the list
 public static void push(ArrayList<Person> list) {
         
 }
     
   
}

In: Computer Science

You are asked to write a simple C++ phonebook application program. Here are the requirements for...

You are asked to write a simple C++ phonebook application program. Here are the requirements for the application.

  • read the contact information from a given input file (phonebook.txt) into a dynamically created array of Contact objects. Each line of the input line includes name and phone information of a contact. Assume that each name has a single part
  • Allow to perform operations on array of data such as search for a person, create a new contact or delete an existing contact

A sample run:

***MY PHONEBOOK APPLICATION***

Please choose an operation:

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): A

Enter name: MARY SMITH

Enter phone: 5062396

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): S

Enter name: MARY SMITH

Phone Number: 5062396

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L

BARBARA BROWN 4059171

ELIZABETH JONES 2736877

LINDA WILLIAMS 3532665

PATRICIA JOHNSON 973437

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): D

Enter name: LINDA WILLIAMS

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): L

BARBARA BROWN 4059171

ELIZABETH JONES 2736877

PATRICIA JOHNSON 973437

A(Add) | S (Search) | D(Delete) |L(List) |Q(Quit): Q

In: Computer Science

Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and...

Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and a parameter of type int. The first parameter is the plaintext message, and the second parameter is the encryption key. The method strictly does the following tasks:

a. Convert the string into a list (let us refer to it as lista). An element in the generated list is the position of the corresponding letter in the parameter string in the English alphabet. Example: ‘C’ or ‘c’ in the parameter string will be converted to the number

b in lista. Assume that the parameter string contains only alphabetic characters. 2. Encrypt the generated list (lista) using Caesar cipher using the provided encryption key. You do not need to create a new list, update the elements of the lista list.

c. Convert lista into a string again by converting the positional element in the list to a character in the ciphertext string. Assume that the plaintext is ‘WelcomeToCryptography’ and the shift key is 5.

Step Output 1

lista = [22, 4, 11, 2, 14, 12, 4, 19, 14, 2, 17, 24, 15, 19, 14, 6, 17, 0, 15, 7, 24] 2

lista = [1, 9, 16, 7, 19, 17, 9, 24, 19, 7, 22, 3, 20, 24, 19, 11, 22, 5, 20, 12, 3] 3

ciphertext = ‘BJQHTRJYTHWDUYTLWFUMD’

The method’s header is as follows: def casesarencryption(s, key):

In: Computer Science

File density.txtPreview the document contains a list of the density in grams per cubic centimeter of...

File density.txtPreview the document contains a list of the density in grams per cubic centimeter of all the planets, plus Pluto. It looks like this: Mercury 5.43 Venus 5.25 Earth 5.52 Mars 3.83 Jupiter 1.33 Saturn 0.71 Uranus 1.24 Neptune 1.67 Pluto 2.05 Write a program named lastname_firstname_density.py that reads the numbers from the file into a list and then calculates and prints, properly labeled: The minimum density The maximum density The average density The median density (Hint: use split() to separate the planet name from the density.) You don’t need a list for the first three of these, but you do need a list to calculate the median. Finding the Median To find the median of a group of n numbers, sort them into order. (Hint: use Python’s sort method). If n is odd, the median is the middle entry. In a list named data this will be element data[(n ‑ 1) // 2]. Note the use of // to do integer division. If n is even, the median is the average of the numbers “surrounding” the middle. For a list named data, this is (data[(n // 2)] + data[(n // 2) ‑ 1]) / 2.0. Your program must work for a file with any number of entries. The file I am providing happens to have an odd number of entries, but if I gave you a similar file for the major moons of Saturn, it would have an even number of entries, and your program would still have to correctly calculate the statistics for that file.

In: Computer Science

{PYTHON }You have a CSV file containing the location and population of various cities around the...

{PYTHON }You have a CSV file containing the location and population of various cities around the world. For this question you'll be given a list of cities and return the total population across all those cities. Write a function named "total_population" that takes a string then a list as parameters where the string represents the name of a CSV file containing city data in the format "CountryCode,CityName,Region,Population,Latitude,Longitude" and the second parameter is a list where each element is itself a list containing 3 strings as elements representing the CountryCode, CityName, and Region in this order. Return the total population of all cities in the list. Note that the city must match the country, name, and region to ensure that the correct city is being read.

import pandas as pd #to read csv into a dataset
  
def total_population(file_name, city_list): #function definition with required parameters
data = pd.read_csv(file_name) #reading a csv file
pop = 0 #for storing population
for i in city_list: #looping through the list
temp = data.loc[(data.Country == int(i[0])) & (data.City == i[1]) & (data.Region == i[2])] #selecting row matching the conditions
pop += int(temp['Population']) #summing population for each city
return pop

error on input ['cities.csv', [['nl', 'vlissingen', '10'], ['ca', 'whitehorse', '12'], ['ph', 'camflora', 'H2'], ['gb', 'johnshaven', 'T6']]]: 'DataFrame' object has no attribute 'CountryCode'

also that return outside function

In: Computer Science

Program Specification: (Visual Studio C++) 1. Read data for names and weights for 15 people from...

Program Specification: (Visual Studio C++)
1. Read data for names and weights for 15 people from the console where there is a name on a line followed by a weight on the next line.
2. Your program will build a list for the data maintained in ascending order based on both name and weight via a doubly linked list.
3. This dll will use one pointer to keep weights in sorted order, and use the other link to keep names on sorted order.
4. You need to build the list as you go maintaining this ordering, so at any time a print method was called it would print the related field in order. (This means nodes are added to the list in sorted order, elements are not added to the list followed by a sort called on the list.)

For example after 3 elements are added for (Name – Weight):
Michael – 275, Tom – 150, Abe – 200.

Output:
Names & weights sorted(ascending) by name. : Abe – 200, Michael – 275, Tom - 150
Names & weights sorted(ascending) by weight. : Tom – 150, Abe – 200, Michael - 275

Jim
150
Tom
212
Michael
174
Abe
199
Richard
200
April
117
Claire
124
Bobby
109
Bob
156
Kevin
145
Jason
182
Brian
150
Chris
175
Steven
164
Annabelle
99

In: Computer Science

Hello. Please answer the following two-part question in Scheme. Not Python, not any form of C,...

Hello. Please answer the following two-part question in Scheme. Not Python, not any form of C, but in the language Scheme. If you do not know Scheme, please do not answer the question. I've had to upload it multiple times now. Thank you.

3.1 Write a recursive function called split that takes a list and returns a list containing two lists, each of which has roughly half the items in the original list. The easiest way to do this is to alternate items between the two lists, so that (split '(1 2 3 4 5)) would return '((1 3 5) (2 4)). I recommend using two base cases: one for an empty list and the other for a list containing one item.
> (split '())

(() ())

> (split '(3))

((3) ())

> (split '(4 8))

((4) (8))

> (split '(8 6 7 5 3 0 9))

((8 7 3 9) (6 5 0))


3.2 Write a recursive function called merge that takes two sorted lists of numbers and merges them together into one sorted list containing all of the number in both lists including duplicates.
> (merge '() '())

()

> (merge '() '(1 2 3))

(1 2 3)

> (merge '(1 2 3) '())

(1 2 3)

> (merge '(2 4 7) '(1 3 5))

(1 2 3 4 5 7)

In: Computer Science

HTML WEBSITE WITH CSS LAYOUT 1. Create a studentregistration form with the following fields: > Email...

HTML WEBSITE WITH CSS LAYOUT

1. Create a studentregistration form with the following fields:
> Email Address (Email)
> Desired Username (Text box)
> Password (Password)
> Family name (Text box)
> Middle Name/Initial (Text box)
> First name (Text box)
> Gender (Radio Button - Male or Female only!)
> ID Number (Text box)
> Mobile Number (Text box)
> Landline Number (Text box)
> Permanent Home Address (Text box)
> Degree/Course (Text box)
> Year Level (Drop down - year 1 to 5)
> Campus (Radio Button - Main Campus, Banilad Campus, LM Campus, Mambaling Campus)
> Name of Father (Text box)
> Name of Mother (Text box)
> Name of Guardian (Text box)
> Hobbies (Checkbox, a user can select multiple hobbies, at least 10 hoobies listed)
> Interests (Checkbox, a user can select multiple interest, at least 10 interest listed)
> Civil Status (Dropdown - Single, Married, Separated, Widow)
> Favorite Color (Color Picker)
> Date of Birth (Month, Day, Year - three textboxes)
> Describe yourself (Text area)
> Rate your satisfaction inside UC (Range input - ranging from 1 - 10)
> Submit button (Display "Registered" in a separate page when the user click this button - this is only for display, no backend scripts required to save the data)
> Clear button (Clear all the fields when user clicks)

2. Create a login form.
> Username
> Password
> Login Button
> Reset Button

* Arrange all your fields in a table format. You can also use the fieldset element to arrange your fields.
* Make your design clean as possible.
* Make all your fonts readable.
* If you want to use/apply colors, use only 3 colors.
* Include the Registration and Login Links in the menu area.
* Maintain the layout of your page.

In: Computer Science