Questions
For Each question the starter code is listed below Make shure complete in simple Python 1)Write...

For Each question the starter code is listed below Make shure complete in simple Python

1)Write a function that removes all occurrences of a given letter from a string.
def remove_letter(theLetter, theStri


2)Write a function that reverses its string argument.
def reverse(astring):

3)Write a function that implements a substitution cipher. In a substitution cipher one letter is substituted for another to garble the message. For example A -> Q, B -> T, C -> G etc. Your function should take two parameters, the message you want to encrypt, and a string that represents the mapping of the 26 letters in the alphabet. Your function should return a string that is the encrypted version of the message.

def encrypt(message, cipher):

4)Write a function sum_of_squares(xs) that computes the sum of the squares of the numbers in the list xs.
For example, sum_of_squares([2, 3, 4]) should return 4 + 9 + 16 which is 29.
def sum_of_squares(xs):
# your code here


5)Create a list containing 100 random integers between 0 and 1000 (use iteration, append, and the random module). Write a function called average that will take the list as a parameter and return the average. Then print the average out, calling your function.


6)The function sumEven should return the sum of only the even numbers contained in the list, lst.
Example
list_of_nums = [1, 5, 4, 8, 5, 3, 2]
x = sum_evens(list_of_nums)
print(x) #prints 14
The function unique_count returns the number of unique items in its parameter, lst, which is a list.
For example, if given the list [3, 3, 3, 5, 3], unique_count would return 2, because there are only two unique items in the list: 3 and 5.
def unique_count(lst):




In: Computer Science

Q#1 Write a C++ program that reads n integer values and stores them in an array...

Q#1 Write a C++ program that reads n integer values and stores them in an array of maximum 20 integers. Read from the user a valid value of n (n should not exceed 20). After reading the n array elements find the maximum and minimum elements. Q#2 Write a C++ program that reads 10 integer values and stores them in an array. The program should find and display the average of the array elements and how many elements are below the average. Q#3 Write a C++ program to read 10 temperatures in Celsius and to store the temperatures in an array of integers, then it should convert the temperatures to Fahrenheit and store the new values rounded to the nearest integer in another array . The program should display both temperatures in a table form. F = 9/5 x C + 32 where F is temp in Fahrenheit and C temperature in Celsius

In: Computer Science

Write a JAVA program to modify the insert and remove of a binary search tree to...

Write a JAVA program to modify the insert and remove of a binary search tree to become an AVL tree.

In: Computer Science

What is the defining characteristic of a transient server and how does it affect application design?

What is the defining characteristic of a transient server and how does it affect application design?

In: Computer Science

In JAVA, students will create a linked list structure that will be used to support a...

In JAVA, students will create a linked list structure that will be used to support a role playing game. The linked list will represent the main character inventory. The setting is a main character archeologist that is traveling around the jungle in search of an ancient tomb. The user can add items in inventory by priority as they travel around (pickup, buy, find), drop items when their bag is full, and use items (eat, spend, use), view their inventory as a whole or by category, request the number of items in inventory, and request to see values for specific inventory items. The categories for items are food, coins, archeology tools, artifacts, and documents. Each item should have an item number (unique integer value in priority order), category (string or integer), a description (string), and a value (integer). The program will use the linked list structure to allow the user to do the functions mentioned above; add (beginning/end), remove (from end), insert (based on ID number), delete (based on ID number), print inventory, print inventory by category, tell if the inventory is empty, tell how many items are in inventory, tell how many items in each category, and search for an item by name or ID and return its value. The code must validate the user input for valid choices and valid input type and throw exceptions that result in an appropriate message to the user. The code must also throw exceptions for trying to retrieve/print a node from an empty list. Please help ASAP

In: Computer Science

Do you need a laptop for a computer science internship? Or do they provide you with...

Do you need a laptop for a computer science internship? Or do they provide you with everything? Would having your own laptop be preferred? are you allowed to use your own laptop?

In: Computer Science

The following questions relate to implementations of unbounded arrays. Read both parts before answering either of...

The following questions relate to implementations of unbounded arrays. Read both parts before answering either of them.
i. Describe an implementation of an unbounded array that has amortised cost of O(1) on both pushBack and popBack operations. In your description make sure you say how and when the necessary allocations and deallocation operations are performed.

ii. Use amortised analysis to demonstrate that pushBack and popBack can be performed on the structure you described in part (i) above at an amortised cost of O(1).

In: Computer Science

Develop SQL statements to do the following: Query 1: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_EMP_CITY,...

Develop SQL statements to do the following:

Query 1: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_EMP_CITY, LXXX_EMP_PHONE, LXXX_DEP_ID, order by LXXX_DEP_ID.

Query 2: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_DEP_NAME, order by LXXX_DEP_NAME.

Query 3: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_DEP_NAME who work for the "XXX_SALES" department.

Query 4: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_DEP_NAME, LXXX_EMP_CITY, LXXX_DEP_CITY who live and work in the same city, order by LXXX_DEP_CITY

Query 5: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_PROJ_TYPE, LXXX_START_DATE, LXXX_END_DATE who have worked in either an “XXX_CUSTOMER SURVEY” project or an “XXX_CUSTOMER GOLF OUTING” project.

Query 6: List all employees by LXXX_EMP_ID, LXXX_EMP_NAME, LXXX_ROLE_NAME who have worked in the role of an “XXX_PROJECT MANAGER”.

In: Computer Science

I am attempting to construct a queue through a linked list using a node data structure...

I am attempting to construct a queue through a linked list using a node data structure with different data types (char, int) in C++. Is this possible or can the queue be of only one data type? My queue has both names and numbers in it so what data type would be best? Can a "char" data type store integers? Can a "string" data type store integers?

In: Computer Science

(Java program) Write an applet that draws two animated cars that must race each other. The...

(Java program) Write an applet that draws two animated cars that must race each other. The race cars should move along a straight line, with each starting behind a Start Line. The user should have the option to set the speed of each car. The speed range is 0 to 100. There should be a Start button to begin the race and an End button to stop the race at any time.

In: Computer Science

Explain the Windows Recovery Environment. How is it used?

Explain the Windows Recovery Environment. How is it used?

In: Computer Science

Respond to the following in a minimum of 175 words: One of the most important concepts...

Respond to the following in a minimum of 175 words:

One of the most important concepts of programming is handling input and output. The following activity will allow you to get familiar with this concept specifically when using Python.

   

Write a function to add two values and display the results.

Discuss the steps in your thought process as you created the code, any issues you encountered, and how you solved those issues.   

In: Computer Science

mips code for n queen problem

mips code for n queen problem

In: Computer Science

1. All members may be public for this example 2. You will need three data members:...

1. All members may be public for this example
2. You will need three data members:
a. An array of 3 doubles to keep the votes

b. An array of 3 strings to place the candidates names

c. An array of 3 doubles to place the calculates vote breakdown

3. You will need three methods:
a. A constructor that receives three strings and sets the names of the candidates to these strings and set all the votes initially to zero.
b. A "calcPercentages" method that has no arguments or return values and simply calculates each vote percentage as one vote count divided by the sum times 100
c. A "display Results" method that has no arguments and displays each candidate's names and vote percentage.

source:
#include <iostream>       //for cout
#include <string>       //for string
#include <stdlib.h>        //for rand, srand
#include <time.h>       //for time

using namespace std;
//DO NOT EDIT ANY CODE ABOVE THIS LINE EXCEPT FOR LINE 12 (EDITOR'S NAME)


class CElection
{
   public:
      
};

//DO NOT EDIT ANY CODE BELOW THIS LINE!
int main(void)
{
   //Instantiate a CElection object with three names:
   CElection TOOP("Alice","Bob","Other");

   //First display a hello message
   cout << "\n\n* Welcome to Decision 2019 *\n";

   //Randomize the PRN
   srand(time(NULL));

   int vote;
   for (int i=1;i<=10000;i++)
   {
       vote = rand()%5;
       switch (vote)
       {
       case 0:
       case 1:
           TOOP.votes[0]++;
           break;
       case 2:
       case 3:
           TOOP.votes[1]++;
           break;
       case 4:
           TOOP.votes[2]++;
       }
   }

   TOOP.calcPercentages();

   TOOP.displayResults();
}

​​​​​​​

In: Computer Science

Write a java program: Write a program that creates a text file. Write to the file...

Write a java program:

Write a program that creates a text file. Write to the file three lines each line having a person's name. In the same program Append to the file one line of  'Kean University'.  In the same program then Read the file and print the four lines without lines between.

In: Computer Science