Create individual python code cells for each of the three problems below. In each code cell, use any additional variables and comments as needed to program a solution to the corresponding problem. When done, download the ipynb file and submit it to the appropriate dropbox in the course's canvas page
. 1.
a. Cell Number 1 * Recreate the same list of dictionaries you used during assignment 2.09. (Scroll down to see assignment 2.09 instructions) * Create another variable and define it as an empty list. It will store middle names, so name the variable appropriately. * Loop through the list of dictionaries using a `for` loop, and add each middle name to the list created to hold middle names in the previous bullet point.
b. Cell Number 2 * Create a variable and assign it the length of the middle names list created in the previous cell. Use the appropriate instruction to calculate the length instead of just typing the correct number, which is known as hard-coding. (Hint: You don't have to redefine the list in the new cell as long as you ran the previous cell recently) * Use a `while` loop to count up to the length of the middle names list, and print out the index and value of each item in the list using a format string. (Hint: start your counter at `0` and stop iterating before you reach the length by using a `<` operator)
c. Cell Number 3 * Loop through the list of dictionaries defined in the first cell using another `for` loop. (Hint: Again, you do not need to redefine the list of dictionaries from the previous cell as long as you executed it recently) * Nested inside of that loop, loop through the keys in the current dictionary using another `for` loop and the `enumerate()` instruction. * Nested inside of the nested loop, print out the key and value using a format string. (Hint: You'll need to use the key to get the value out of the dictionary) * Also inside of the nested loop, once the index is greater than or equal to 2, break out of the loop.
2.09 assingment instructions for question 1
**Requirements:** * Create a list containing separate dictionaries for at least 3 people (family members, actors, invisible friends, etc.) and assign the list to a variable. Instead of using your actual family members' names, I want you think of different names starting with the same letter as your family member so that I can't be accused of identity theft. * Each person dictionary should have at least 4 key/value pairs: * first name * middle name. * age (rounded to the nearest decade) * your favorite thing about them * Be sure to use the same keys for each person (eg. "first_name" for everyone's first names). * Print out the entire list.
In: Computer Science
Working with Vendors
Respond to the following in a minimum of 175 words:
In: Computer Science
Create a new Python 3 Jupyter Notebook. Create one python code cell for the problem below. Use any additional variables and comments as needed to program a solution to the corresponding problem. All functions should be defined at the top of the code in alphabetical order.
*Problem:* 1. Define a function with the following characteristics: * The function's purpose will be checking that a number matches another, so it should be named appropriately. * It must accept one parameter, which is the number it will be checking. Name this parameter appropriately. * It must have an appropriate docstring. * There needs to be a variable defined within the program that is the integer value of ((your birth month prepended to your birth year) mod 555). So if your birthday is October 1925, this variable would be (`101925 % 555`). It is the number the argument will be compared to, so name it appropriately. * If the numbers match, the function should return `True`, otherwise `False`.
2. Define a different function with the following characteristics: * This function will be trying to guess a passcode, so it should be named appropriately. * It must accept two parameters, both with default values. * The first parameter will be for the smallest number to check and its default value will be `0`. * The second parameter will be for the largest number to check and its default value will be `100`. * The function must have an appropriate docstring. * Create a variable to hold the correct passcode. You won't know the value yet, so define it as `None`. * Build a list of all of the numbers from the smallest to the largest (it must include the largest number in the list). *Hint: Use the `range()` function with the first argument as the smallest number and the second argument as the largest value plus `1`.* * Loop through the list and for each iteration of the loop, do the following: * Call the function described in step 1 with the current list item as the argument and assign its return value to a variable. * If the function above returns `True`, store the current list item in the correct passcode variable and break out of the loop. * Return the correct passcode.
3. In your main code section, call the function defined in step 2 and store its return value in a variable named "`passcode`". You'll use the default argument value for the smallest number, so leave it out of the call. However, for the largest number, you need to pass in `555` as the argument. 4. Print out the correct passcode in a format string with a friendly (or funny) message.
**Rubric:** * Adequate readability, comments, etc.
* Uses docstrings for methods * Calls checker function using default argument for the first parameter
* Calls checker function overriding argument for second parameter * Has a method to check against mod value
* Uses mod correctly * Has a method to loop through range * Uses default argments for parameters
* Range is defined using second parameter plus one
* Break out of loop when value is found
* Store in variable named passcode
* Uses a format string to print
* Has a main code section
In: Computer Science
Explain the difference in the C memory model between global and local variables. How is each allocated and accessed?
In: Computer Science
This week is about Big Data, one of the most "talked about" topics in the world of data. Many of you are aware of the 3Vs of Big Data.
In 200 words:
Now, what real-world example(s) come to your mind when you think of 3Vs? Also, please explain the different "Sources of Big Data" in your own words.
In: Computer Science
Please no plagiarism and must be in your own 500 words
the concept of Blockchain. There is still much confusion regarding what Blockchain is and what it is not. Please discuss your explanation of Blockchain to include why it has been gaining so much popularity.
In: Computer Science
Translate the following C program to Pep/9 assembly language.
#include <stdio.h>
int main(){
int numItms, j, data, sum;
scanf("%d",&numItms);
sum = 0;
for(j = 1; j <= numItms; j++){
scanf("%d",&data);
sum += data;
}
printf("Sum:%d\n",sum);
return 0;
}
SAMPLE INPUT: 48-376
SAMPLE OUTPUT: Sum: 18
In: Computer Science
Write a report about LAN
The report should contain the folowing information.
In: Computer Science
In: Computer Science
Use following case and create Entity-Relationship Diagrams using the Crow’s Feet method for each. Each ERD should be completed on a separate sheet of paper, if drawn by hand. If additional assumptions are made for any of your 2cases, be sure to document the additional business rules and include them with your ERDs.
Entity-Relationship Diagram : TEXTBOOK REVIEWS Your website would like to add the ability for school BIT students to provide reviews for textbooks they have previously used. Using the following business rules, create an ERD:
Students must enter the ISBN for the book, along with its title, author, publisher, and copyright date.
Users will be asked to select what course the book was used for from a predefined list of courses offered in the BIT division.
Each course will be assigned to a program such as Web Development, Software Development, Computer Support, Photography, etc.
Each book can have more than one author.
Each book can only have one publisher.
Each book could have been used in multiple courses.
Many reviews could be written for a book, but each review can only be about one book.
Reviews may be written anonymously or by a logged in user.
In: Computer Science
You work for a software company has just created a new incentive for salespeople to earn a commission on each sale. The current program only allows for a fixed salary. The Chief Information Officer (CIO) has asked you to create a new program that allows the functionality for a fixed salary and commission.
Write a Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson.
Consider the following:
The Java® application should meet the following technical requirements:
Compile your Java® application files into a ZIP folder.
In: Computer Science
Deal or No Deal
Assignment
Have you watched the gameshow Deal or No Deal? We are going to
design a smaller version of it.
Parameters
• We’ll have 25 differing dollar amounts from $1 to
$1,000,000. (Let’s use 25, not 26; drop the 1 cent value in the
original game values.) Each dollar amount is randomly placed in one
of 25 briefcases, and none of the game players know the
locations.
• We’ll only implement 1 Round with 4 states:
1. Player makes guess of Prize briefcase
2. Player opens N other briefcases
3. Banker makes an offer to buy back Prize
briefcase
4. Player responds – and wins or looses
Board Presentation
Show the 25 briefcases as a 5x5 grid. (You can hardcode the 25 and
5x5 – these parameters don’t change.) Each cell of the grid
represents a briefcase. The contents of the cell can display 1 of 2
things: either a closed briefcase or an opened briefcase. If
closed, then just show the briefcase number; if opened then display
the dollar amount inside.
Also show the remaining Cash Values still in play. I used a 2-row
table where the values opened have a grey background. The other
values are in the closed briefcases and one is the Prize
Briefcase.
Rules of Play
There are 2 participants: The Player and The Banker. The Player
wants to make as much money as possible, and The Banker wants to
keep as much money as possible.
We’ll only do 1 Round. So, we’ll have 4 steps or 4 States to our
game.
1. Initialize: This is the setup for the board and
initializing the State Variables (hiddens).
2. Prize Briefcase selection: The player first picks
their prize briefcase. In the picture above, the player selected
Case #17. That selection must be stored in a State Variable for the
entire game – so the game can “remember” it. (The dollar amount
contents of the Prize Briefcase is not displayed, of course, so
keep the case “closed.”)
3. Open N other briefcases: Now the player picks N
other briefcases to open. For our miniature game with only one
round, N=6. After the user selects 6 briefcases, they are opened
and the dollar contents displayed to everyone.
4. Accept or reject The Offer from the Banker: The game
pauses. The Banker now makes an offer by buy back the Prize
Briefcase from the player –with unknown contents to all. The Banker
doesn’t know contents of the Prize Briefcase but doesn’t want it to
be big. So, the Banker offers a price somewhere in the middle of
the range of the remaining dollar amounts.
The Player can accept or reject the offer from The Banker. In our
game, either way, this is the end of the game. In the real game, if
the offer is not selected, then the next round continues with N=N-1
briefcases opened until there is only 2 left.
State Variables
I had 3 State Variables.
• $state – this is an integer. It goes from 0 to
3.
• $caseCash – this is a 1-D array of length 25. Each
cell is a briefcase. The value of the array is the cash in the
briefcase.
• $caseState – this is also a 1-D array of length 25.
Each cell is a briefcase. The value is a string representing the
status of the briefcase. There are 3 options: closed, opened, or
the 1 Prize Briefcase. In my game:
o A dot ‘.’means the briefcase is closed. o An ‘o’
means that the briefcase is opened.
o The string ‘prize’ means that The Player has selected
that briefcase for their prize at the end.
The Banker
The job of The Banker is to “save” money. He knows The Player will
get the cash in the Prize Briefcase. The Banker’s job is to “buy”
the Briefcase back from The Player, hopefully for less money than
is in the Prize Briefcase. Neither party know the contents of the
Prize Briefcase, so both parties are gambling.
A very simple algorithm for The Banker is simply to take the
average() of all the unopened, remaining briefcases. The Average
will be right in the middle. That makes it a 50% chance that The
Banker does better and a 50% chance that The Player does better.
You are free to make The Offer using any function you want. Have
fun.
In: Computer Science
In: Computer Science
Write a public Java class called DecimalTimer with public method displayTimer, that prints a counter and then increments the number of seconds. The counter will start at 00:00 and each time the number of seconds reaches 60, minutes will be incremented. You will not need to implement hours or a sleep function, but if minutes or seconds is less than 10, make sure a leading zero is put to the left of the number.
For example, 60 seconds:
00:00
00:01
00:02
. . .
00:58
00:59
01:00
In: Computer Science
Given a data file murders.dat containing the number of murders in Hampton roads cities write program code to accomplish the following: 1. Read the data from the murders.dat file and store into parallel arrays or an array of struct 2. Print the total number of murders in the Hampton roads cities 3. Print all of the data read 4. Print the name of the city with the most murders 5. Print the name of the city with the least murders 6. Print the names of all cities with 10 or more murders 7. Print cities sorted by number of murders (lowest to highest)
C++
i just need help with printing the cities sorted by number of murders
In: Computer Science