<file_sep>#include <iostream>
#include <cassert>
#include <vector>
using namespace std;
int fibonacci_naive(int n) {
    if (n <= 1)
        return n;
  return fibonacci_naive(n - 1) + fibonacci_naive(n - 2);
}

long long fibonacci_fast(int n) {
    vector<long long> f;
    f.push_back(0);
    f.push_back(1);
    for (int i = 2; i <= n; i++){
        f.push_back(f[i-1] + f[i-2]);
    }
    return f[n];
}

void test_solution() {
    assert(fibonacci_fast(3) == 2);
    assert(fibonacci_fast(10) == 55);
    for (int n = 0; n < 20; ++n)
        assert(fibonacci_fast(n) == fibonacci_naive(n));
}

int main() {
    int n;
    cin >> n;
    // cout << fibonacci_naive(n) << '\n';
    // test_solution();
    if (n <= 1){
        cout << n;
    }
    else
    {
        cout << fibonacci_fast(n) << '\n';
    }
    return 0;
}
<file_sep># Quiz

### Que 1

How are Managed Services useful?

### Answer

Managed Services may be an alternative to creating and managing infrastructure solutions.

### Que 2

Which of the following is a feature of Cloud Dataproc?

### Answer

It typically takes less than 90 seconds to start a cluster.
<file_sep># Week 2 Quiz

### Question

Curiosity is an analytical skill that involves which of the following?

### Answer

Seeking out new challenges and experiences

### Question

Understanding context is an analytical skill best described by which of the following? Select all that apply.

### Answer

    Gathering additional information about data to understand the broader picture
    Identifying the motivation behind the collection of a dataset
    Adding descriptive headers to columns of data in a spreadsheet

### Question

A data analyst works for an appliance manufacturer. Last year, the company’s profits were down. Lower profits can be a result of fewer people buying appliances, higher costs to make appliances, or a combination of both. The analyst recognizes that those are big issues to solve, so they break down the problems into smaller pieces to analyze them in an orderly way. Which analytical skill are they using?

### Answer

A technical mindset

### Question

Which analytical skill involves managing the people, processes, and tools used in data analysis?

### Answer

Data strategy

### Question

Correlation is the aspect of analytical thinking that involves figuring out the specifics that help you execute a plan.

### Answer

False

### Question

What method involves asking numerous questions in order to get to the root cause of a problem?

### Answer

The five whys

### Question

Gap analysis is a method for examining and evaluating how a process works currently in order to get where you want to be in the future.

### Answer

True

### Question

A company is receiving negative comments on social media about their products. To solve this problem, a data analyst uses each of their five analytical skills: curiosity, understanding context, having a technical mindset, data design, and data strategy. This makes it possible for the analyst to use facts to guide business strategy and figure out how to improve customer satisfaction. What is this an example of?

### Answer

Data-driven decision-making

### Question

Adding descriptive headers to columns of data in a spreadsheet is an example of which analytical skill?

### Answer

Understanding context

### Question

Fill in the blank: **\_** involves the ability to break things down into smaller steps or pieces and work with them in an orderly and logical way.

### Answer

A technical mindset

### Question

Data design is how you organize information; data strategy is the management of the people, processes, and tools used in data analysis.

### Answer

True

### Question

The manager at a music shop notices that more trombones are repaired on the days when Alex and Jasmine work the same shift. After some investigation, the manager discovers that Alex is excellent at fixing slides, and Jasmine is great at shaping mouthpieces. Working together, Alex and Jasmine repair trombones faster. The manager is happy to have discovered this relationship and decides to always schedule Alex and Jasmine for the same shifts. In this scenario, the manager used which quality of analytical thinking?

### Answer

Correlation

### Question

Data analysts ask, “Why?” five times in order to get to the root cause of a problem.

### Answer

True

### Question

An airport wants to make its luggage-handling process faster and simpler for travelers. A data analyst examines and evaluates how the process works currently in order to achieve the goal of a more efficient process. What methodology do they use?

### Answer

Gap analysis

### Question

Fill in the blank: Data analysts use the five analytical skills of curiosity, understanding context, having a technical mindset, data design, and data strategy to make **\_** decisions.

### Answer

data-driven

### Question

Having a technical mindset is an analytical skill involving what?

### Answer

Breaking things down into smaller steps or pieces

### Question

Fill in the blank: Data strategy involves **\_** the people, processes, and tools used in data analysis.

### Answer

managing

### Question

Fill in the blank: Being able to identify a relationship between two or more pieces of data describes **\_**.

### Answer

correlation

### Question

A junior data analyst is seeking out new experiences in order to gain knowledge. They watch videos and read articles about data analytics. They ask experts questions. Which analytical skill are they using?

### Answer

Curiosity

### Question

Data-driven decision-making involves the five analytical skills: curiosity, understanding context, having a technical mindset, data design, and data strategy. Each plays a role in data-driven decision-making.

### Answer

True
<file_sep># Quiz

### Que 1

Why might a GCP customer choose to use Cloud Source Repositories?

### Answer

They don't want to host their own git instance, and they want to integrate with IAM permissions.

### Que 2

Why might a GCP customer choose to use Cloud Functions?

### Answer

Their application contains event-driven code that they don't want to have to provision compute resources for.

### Que 3

Why might a GCP customer choose to use Deployment Manager?

### Answer

Deployment Manager is an infrastructure management system for GCP resources.

### Que 4

You want to define alerts on your GCP resources, such as when health checks fail. Which is the best GCP product to use?

### Answer

Stackdriver Monitoring

### Que 5

Which statements are true about Stackdriver Logging? Choose all that are true (2 statements)

### Answer

    Stackdriver Logging lets you define metrics based on your logs.
    Stackdriver Logging lets you view logs from your applications, and filter and search on them.
<file_sep>## Quiz

### Question 1

Assume that we have typed the following in the Python shell:

```
>>> x = ‘chemistry’
>>> x[3]
```

### Answer

m

### Question 2

Assume that we have typed the following in the Python shell:

```
>>> x = ‘chemistry’
>>> ‘i’ in x
```

### Answer

True

### Question 3

Assume that we have typed the following in the Python shell:

```
>>> x = ‘3’
>>> y = ‘4’
>>> x + y * 2
```

### Answer

344

### Question 4

Assume that we have typed the following in the Python shell:

```
>>> x = [1, 2]
>>> y = [3, 4]
>>> x.append(y)
>>> x
```

What will be printed on the screen as a result?

### Answer

[1, 2, [3, 4]]

### Question 5

Assume that the following Python program is executed:

![Que-5](./pic1.png)

What will be printed on the screen as a result?

### Answer

2

### Question 6

Assume that the following Python program is executed:

![Que-6](pic2.png)

What will be printed on the screen as a result?

### Answer

[4, 5, 5, 6]

### Question 7

Correct indentation is essential for your Python program to work.

### Answer

True

### Question 8

Raspberry Pi can execute Python 3 code, but not Python 2.

### Answer

False
<file_sep># Week 2 Quiz

### Question 1
Suppose I define the following function in R

```
cube <- function(x, n) {
        x^3
}
```
What is the result of running
`cube(3)`
### Answer
The number 27 is returned

### Question 2
The following code will produce a warning in R.
```
x <- 1:10
if(x > 5) {
        x <- 0
}
```
Why?
### Answer
'x' is a vector of length 10 and 'if' can only test a single logical statement.

### Question 3
Consider the following function
```
f <- function(x) {
        g <- function(y) {
                y + z
        }
        z <- 4
        x + g(x)
}
```
If I then run in R
```
z <- 10
f(3)
```
### Answer
10

### Question 4
Consider the following expression:
```
x <- 5
y <- if(x < 3) {
        NA
} else {
        10
}
```
What is the value of 'y' after evaluating this expression?
### Answer
10

### Question 5
Consider the following R function
```
h <- function(x, y = NULL, d = 3L) {
        z <- cbind(x, d)
        if(!is.null(y))
                z <- z + y
        else
                z <- z + f
        g <- x + y / z
        if(d == 3L)
                return(g)
        g <- g + 10
        g
}
```
Which symbol in the above function is a free variable?
### Answer
f

### Question 6
What is an environment in R?
### Answer
a collection of symbol/value pairs

### Question 7
The R language uses what type of scoping rule for resolving free variables?
### Answer
Lexical scoping

### Question 8
How are free variables in R functions resolved?
### Answer
The values of free variables are searched for in the environment in which the function was defined

### Question 9
What is one of the consequences of the scoping rules used in R?
### Answer
All objects must be stored in memory

### Question 10
In R, what is the parent frame?
### Answer
It is the environment in which a function was called
<file_sep>## Python 3 Programming Specialization offered by University of Michigan

### This module contains the solutions from the courses that I have completed in the above mentioned Specialization.<file_sep># IMPORTANT
Please perform the operations provided on the Qwiklabs page. Those operations are performed directly on the terminal in python interpreter and are essential for the grading rubric to mark you. One file has been added i.e. user_emails.csv which is compulsory to create in your linux instance.
<file_sep>## Replace

    firstname,surname,,job title

## with

    firstname,surname,company,job title

## in data.csv
<file_sep>## Assignment

### Project Title

        Smart TV's and Smart Watches

### Identify two embedded systems that are sold on the market today and analyze their interfaces.

        Smart TV's  - Large Screen, Better Clarity
        Smart Watches - Small Screen, Better Portability

### Describe all inputs to each system and outputs from each system.

    1. Smart TV
    Inputs: Touch, Voice, Remote, Smartphone, Computer, Wi-Fi, power
    Outputs: Video, Audio, Apps, Games, Chats, Audio and Video calls

    2. Smart Watches
    Inputs: Touch, Bluetooth, Voice, charge, Smartphone
    Outputs: Audio, Video, Info on screen, Health data like heartrate,       Distance travelled, Audio and Video Calls

### Classify the inputs and outputs based on their mode of interaction:

### -Visual - describing data carried by visible light

### -Audio - describing data carried by sound

### -Tactile - describing data carried by touch

### -Electronic - describing data encoded in electrical signals

        Visual - Info or data provided, Video
        Audio - Calls or movie or a video's sound
        Tactile - Touch
        Electronic - Charge and Power
<file_sep>## This module contains the quiz answers to the course 'Crash course on Python' provided by Google, part of IT Automation Specialization.

### There is no week 5 folder because there's no quiz in week 5<file_sep>#include <bits/stdc++.h>
#include <vector>
using namespace std;
int fun1(int destination, int d_tank, vector<int> stops)
{
    int position = 0;
    int count = 0;
    while (position < destination)
    {
        position += d_tank;
        if (position > destination)
        {
            return count;
        }
        vector<int> temp;
        for (int i = 0; i < stops.size(); i++)
        {
            if (stops[i] <= position)
            {
                temp.push_back(stops[i]);
            }
        }
        if (temp.size() != stops.size() && stops[temp.size()] - temp[temp.size() - 1] > d_tank)
        {
            return -1;
        }
        position = temp[temp.size() - 1];
        count += 1;
    }
    return count;
}

int main()
{
    int destination, d_tank, num, temp;
    cin >> destination;
    cin >> d_tank;
    cin >> num;
    vector<int> stops;
    for (int i = 0; i < num; i++)
    {
        cin >> temp;
        stops.push_back(temp);
    }
    cout << fun1(destination, d_tank, stops);
    return 0;
}<file_sep># Quiz

### Que 1

What data storage service might you select if you just needed to migrate a standard relational database running on a single machine in a datacenter to the cloud?

### Answer

Cloud SQL

### Que 2

Which GCP data storage service offers ACID transactions and can scale globally?

### Answer

Cloud Spanner

### Que 3

Which data storage service provides data warehouse services for storing data but also offers an interactive SQL interface for querying the data?

### Answer

BigQuery
<file_sep># noinspection PyShadowingNames
def signatures(lst, n):
    index = 0
    coordinates = []

    while index < n:
        curr = lst[index]
        while index < n - 1 and curr[1] >= lst[index + 1][0]:
            index += 1
        coordinates.append(curr[1])
        index += 1
    print(len(coordinates))
    return ' '.join([str(i) for i in coordinates])


if __name__ == "__main__":
    num = int(input())
    coordinates = []
    for temp in range(num):
        x, y = input().split()
        coordinates.append((x, y))
    coordinates.sort(key=lambda x: x[1])
    print(signatures(coordinates, num))
<file_sep>def min_stops(destination, d_tank, stops):
    position = 0
    count = 0
    while position < destination:
        position += d_tank
        if position > destination:
            return count
        temp = [i for i in stops if i <= position]
        if len(temp) != len(stops) and stops[len(temp)] - temp[-1] > d_tank:
            return -1
        position = temp[-1]
        count += 1
    return count


if __name__ == "__main__":
    destination = int(input())
    d_tank = int(input())
    num = int(input())
    stops = [int(i) for i in input().split()]
    print(min_stops(destination, d_tank, stops))
<file_sep>#! /usr/bin/env python3
import os
import requests

dir = "/data/feedback/"
for file in os.listdir("/data/feedback/"):
    format = ["title", "name", "date", "feedback"]
    content = {}
    with open('{}/{}'.format(dir, file), 'r') as file:
        counter = 0
        for line in file:
            line = line.replace("\n", "")
            content[format[counter]] = line.strip('\n')
            counter += 1

    response = requests.post("http://172.16.58.3/feedback/", json=content)
    if not response.ok:
        raise Exception("POST failed! | Status code: {} | File: {}".format(
            response.status_code, file))
    print("Feedback Uploaded")
<file_sep># Week 1 Quiz

### Question 1
Select the option that correctly completes the sentence:
Training a model using labeled data and using this model to predict
the labels for new data is known as ____________.
### Answer
Supervised Learning

### Question 2
Select the option that correctly completes the sentence:
Modeling the features of an unlabeled dataset to find hidden
structure is known as ____________.
### Answer
Unsupervised Learning

### Question 3
Select the option that correctly completes the sentence:
Training a model using categorically labelled data to predict labels
for new data is known as __________.
### Answer
Classification

### Question 4
Select the option that correctly completes the sentence:
Training a model using labelled data where the labels are
continuous quantities to predict labels for new data is known as
__________.
### Answer
Regression

### Question 5
Using the data for classes 0, 1, and 2 plotted below, what class
would a KNeighborsClassifier classify the new point as for k = 1 and
k = 3?
![graph](./temp.png)
### Answer
        k = 1: Class 1
        k = 3: Class 2

### Question 6
Which of the following is true for the nearest neighbor classifier
(Select all that apply):
### Answer
Memorizes the entire training set

### Question 7
Why is it important to examine your dataset as a first step in
applying machine learning? (Select all that apply):
### Answer
        See what type of cleaning or preprocessing still needs to be done

        You might notice missing data

        Gain insight on what machine learning model might be
        appropriate, if any

        Get a sense for how difficult the problem might be

### Question 8
The key purpose of splitting the dataset into training and test sets
is:
### Answer
To estimate how well the learned model will generalize
to new data

### Question 9
The purpose of setting the random_state parameter in
train_test_split is: (Select all that apply)
### Answer
To make experiments easily reproducible by always
using the same partitioning of the data

### Question 10
Given a dataset with 10,000 observations and 50 features plus one
label, what would be the dimensions of X_train, y_train, X_test, and
y_test? Assume a train/test split of 75%/25%.
### Answer
        X_train: (7500, 50)
        y_train: (7500, )
        X_test: (2500, 50)
        y_test: (2500, )<file_sep># Week 2 Assignment Quiz
## The functions that will be needed to complete this quiz are in the folder Programming Assignment

### Question 1
What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.
```
pollutantmean("specdata", "sulfate", 1:10)
```
### Answer
4.064

### Question 2
What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.
```
pollutantmean("specdata", "nitrate", 70:72)
```
### Answer
1.706

### Question 3
What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.
```
pollutantmean("specdata", "sulfate", 34)
```
### Answer
1.477

### Question 4
What value is returned by the following call to pollutantmean()? You should round your output to 3 digits.
```
pollutantmean("specdata", "nitrate")
```
### Answer
1.703

## Question 5
What value is printed at end of the following code?
```
cc <- complete("specdata", c(6, 10, 20, 34, 100, 200, 310))
print(cc$nobs)
```
### Answer
228 148 124 165 104 460 232

### Question 6
What value is printed at end of the following code?
```
cc <- complete("specdata", 54)
print(cc$nobs)
```
### Answer
219

### Question 7
What value is printed at end of the following code?
```
RNGversion("3.5.1")  
set.seed(42)
cc <- complete("specdata", 332:1)
use <- sample(332, 10)
print(cc[use, "nobs"])
```
### Answer
711 135 74 445 178 73 49 0 687 237

### Question 8
What value is printed at end of the following code?
```
cr <- corr("specdata")                
cr <- sort(cr)   
RNGversion("3.5.1")
set.seed(868)                
out <- round(cr[sample(length(cr), 5)], 4)
print(out)
```
### Answer
0.2688 0.1127 -0.0085 0.4586 0.0447

### Question 9
What value is printed at end of the following code?
```
cr <- corr("specdata", 129)                
cr <- sort(cr)                
n <- length(cr)    
RNGversion("3.5.1")
set.seed(197)                
out <- c(n, round(cr[sample(n, 5)], 4))
print(out)
```
### Answer
243.0000 0.2540 0.0504 -0.1462 -0.1680 0.5969

### Question 10
Question 10
What value is printed at end of the following code?
```
cr <- corr("specdata", 2000)                
n <- length(cr)                
cr <- corr("specdata", 1000)                
cr <- sort(cr)
print(c(n, round(cr, 4)))
```
### Answer
0.0000 -0.0190 0.0419 0.1901<file_sep>### Question

Write about the design of a system that you might build for your home which uses an Arduino with a wifi shield. The system must use the wifi connection for a useful purpose in the system. The Arduino should be wired to sensors and/or actuators which help it to perform some useful task in your home.

Be sure to clearly describe the need for the wifi connection in your system.

### Answer

I would use Arduino with a Wi-Fi shield to create a Network Attached Storage by connecting the Arduino with a SSD, that can act as the personal cloud storage for my family. Now since cloud storage needs internet access, the arduino will need constant access to internet and that is where the Wi-Fi shield comes in. The shield will enable the arduino to get constant internet access, which will in turn provide instant and fast upload and download speeds for the user.
<file_sep>### Quiz

### Question 1

A light sensor (photoresistor) is an analog sensor.

### Answer

True

### Question 2

A microphone is a digital sensor.

### Answer

False

### Question 3

A push button is an analog sensor.

### Answer

False

### Question 4

A keyboard is a digital sensor.

### Answer

True

### Question 5

Which of the following components are actuators? Select all that apply.

### Answer

        a servo motor
        an LED
        a heating element

### Question 6

The component of an embedded system that executes a program is:

### Answer

A microcontroller

### Question 7

An analog-to-digital converter is common in embedded systems because

### Answer

many sensors are analog while the microcontroller is digital.

### Question 8

Consider the anti-lock braking system in a car. What are the main sensors and actuators of this system from the perspective of the driver?

### Answer

brake pedal and brake calipers and pads
<file_sep># Quiz

### Que 1

What do you have to do to enable encryption when using Cloud Storage?

### Answer

Nothing as encryption is enabled by default.

### Que 2

Which Google Cloud features could help prevent DDoS attacks?

### Answer

All of the these

### Que 3

You don't want programmers to have access to production resources. What's the easiest way to do this in Google Cloud?

### Answer

Create development and production projects, and don't give developers access to production.

### Que 4

What Google Cloud service can you use to enforce the principle of least privilege when using Google Cloud?

### Answer

IAM members and roles
<file_sep># Quiz

### Que 1

In GCP, what is the minimum number of IP addresses that a VM instance needs?

### Answer

One: Only an internal IP address

### Que 2

What are the three types of networks offered in the Google Cloud Platform?

### Answer

Default network, auto network, and custom network.

### Que 3

What is one benefit of applying firewall rules by tag rather than by address?

### Answer

When a VM is created with a matching tag, the firewall rules apply irrespective of the IP address it is assigned.
<file_sep># Quiz

### Que 1

You're creating a service and you want to protect it from being overloaded by too many client retries in the event of a partial outage. Which design pattern would you implement

### Answer

Circuit breaker

### Que 2

You need a relational database for a system that requires extremely high availability (99.999%). The system must run uninterrupted even in the event of a regional outage. Which database would you choose?

### Answer

Spanner
<file_sep>#!/usr/bin/env python3
from PIL import Image
from glob import glob
import os

for file in glob('ic_*'):
    image = Image.open(file).convert('RGB')
    path, filename = os.path.split(file)
    filename = os.path.splitext(filename)[0]  # get filename without extension
    image.rotate(270).resize((128, 128)).save('/opt/icons/{}.jpeg'.format(filena$

print('DONE!!')
<file_sep>## Introduction to Git and Github

### Most of this course is executed directly on the command line like the push or pull requests. Still a few files that were created or required, I have added them to this repo.<file_sep># Converting a wired Canon printer into wireless using a Raspberry Pi

![Printer](./Resources/printer.jpeg)

![Table](./Resources/table.png)

## 1. Raspberry Pi + CUPS:

CUPS (Common UNIX Printing System) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server.

This option is the easiest one, since we just have to download the CUPS software into the Raspberry Pi, get its IP address and type it with “:631” in the bar address in the browser of another computer.

## 2. Raspberry Pi + Sockets:

A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to.

This option is more difficult than the first one, since we have to write our own server code and client code using sockets in order to send the file to be printed, print it, and tell both the server and the client that everything is okay.

We already have an idea about sockets thanks to one of the specialization courses, thus it is a chance for us to implement what we have learned. In contrast, we are not much sure about the security of the system, but we are willing to work more on it

## 3. Arduino:

Since we did not learn how Arduino communicates with the world, we do not know much about the feasibility of this option. (We googled this but it was not much of help). Also, Arduino doesn’t have a USB port, unlike Raspberry Pi, so things will be more complicated.

## We are going for option 2 for various reasons:

1. More difficult than option 1 and less difficult than option 3.
2. We already have the necessary knowledge needed.
3. Although security seems like a problem, but it is faster than the other two options

![Chart](./Resources/chart.png)
<file_sep>## Install Wireshark and start capture

![Scan Results](Capture.png)
<file_sep>## Assignment

### Identify and analyze a device that is an IoT device now, but in the past was a non-IoT device. Describe and list the features of the device. Compare the functions of the device in the past to the functions of the device now.

    A very common example is a television. It just used to be a screen for people to stare at, but now it can be a screen for people to talk to and interact with.

### Compare the functions of the device in the past to the functions of the device now.

    Past functions or the functions of a Digital TV:

    1. Could not access internet
    2. Could not install applications
    3. Limited watching or viewing content
    4. Never had a touch screen
    5. Limited resources to access like channels or stations
    6. Could not multitask
    7. Didn't have as good display

    But a smart TV can do all the above mentioned things and those are the differences between a TV of the past and a TV of the present.

### For your chosen IoT device, list any improvements or any diminishments if they exist, over the non-IOT device. Describe any limitations that are present in the new IoT version of the device.

    Improvements or new features:

    1. Can access the internet
    2. Can install and run applications
    3. Way higher watching content e.g. Netflix, Amazon Prime etc.
    4. Can have a touch screen
    5. Much higher access to resources like channels or stations
    6. Can easily multitask
    7. Can have a 4k or an 8k display

### Describe any privacy issues with the IoT device that never existed in the original version of the device. Compare the price of the original device to the price of the new IoT version of the device. When performing a price comparison, attempt to normalize for the changing value of currency over time by using an online inflation calculator.

    A major privacy issue is that since the smart IoT tv is connected to the internet, it is vulnerable to hacking attempts and other various attacks. Once hacked, the hacker can access all your data through the network that your IoT device is connected to.

    Smart TV's emerged around 2010, and $1 according to that time is $1.19 in 2020. And the price at that time used to be about or under $500 whereas now a smart tv can cost well above $1000. But, it can easily be justified based on the added features and newer advancements.
<file_sep>## Replace

    print("hello " + name + ", your random number is " + number)

## with

      print("hello " + name + ", your random number is " + str(number))

## in greetings.py
<file_sep># Week 2 Assignment Quiz
## The functions that will be needed to complete this quiz are in the folder Programming Assignment

### Question 1
What result is returned by the following code?
```
best("SC", "heart attack")
```
### Answer
MUSC MEDICAL CENTER

### Question 2
What result is returned by the following code?
```
best("NY", "pneumonia")
```
### Answer
MAIMONIDES MEDICAL CENTER

### Question 3
What result is returned by the following code?
```
best("AK", "pneumonia")
```
### Answer
YUKON KUSKOKWIM DELTA REG HOSPITAL

### Question 4
What result is returned by the following code?
```
rankhospital("NC", "heart attack", "worst")
```
### Answer
WAYNE MEMORIAL HOSPITAL

### Question 5
What result is returned by the following code?
```
rankhospital("WA", "heart attack", 7)
```
### Answer
YAKIMA VALLEY MEMORIAL HOSPITAL

### Question 6
What result is returned by the following code?
```
rankhospital("TX", "pneumonia", 10)
```
### Answer
SETON SMITHVILLE REGIONAL HOSPITAL

### Question 7
What result is returned by the following code?
```
rankhospital("NY", "heart attack", 7)
```
### Answer
BELLEVUE HOSPITAL CENTER

### Question 8
What result is returned by the following code?
```
r <- rankall("heart attack", 4)
as.character(subset(r, state == "HI")$hospital)
```
### Answer
CASTLE MEDICAL CENTER

### Question 9
What result is returned by the following code?
```
r <- rankall("pneumonia", "worst")
as.character(subset(r, state == "NJ")$hospital)
```
### Answer
BERGEN REGIONAL MEDICAL CENTER

### Question 10
What result is returned by the following code?
```
r <- rankall("heart failure", 10)
as.character(subset(r, state == "NV")$hospital)
```
### Answer
RENOWN SOUTH MEADOWS MEDICAL CENTER<file_sep>def largest_num(num, nums):
    greatest = ''
    nums.sort()
    for i in nums:
        start = greatest + str(i)
        end = str(i) + greatest
        if int(start) > int(end):
            greatest = start
        else:
            greatest = end
    return int(greatest)


if __name__ == '__main__':
    num = int(input())
    nums = [int(i) for i in input().split()]
    print(largest_num(num, nums))
<file_sep>complete <- function(directory, id = 1:332) {
  
  filenames <- list.files(path=directory, pattern="*.csv")

  ids <-vector()
  counts = vector()

  for(i in id) {

    filename <- sprintf("%03d.csv", i)
    filepath <- paste(directory, filename, sep="/")
    
    data <- read.csv(filepath)

    ids <- c(ids, i)

    completeCases <- data[complete.cases(data),]
    counts <- c(counts, nrow(completeCases))
  }
  

  data.frame(id=ids, nobs=counts)
}
<file_sep>## Quiz

### Question 1

What protocols are required for Internet communication?

### Answer

@TCP or UDP/IP

### Question 2

Which network device copies packets onto all ports?

### Answer

hub

### Question 3

What is the protocol associated with the world wide web?

### Answer

HTTP

### Question 4

A MANET protocol is likely to differ from a typical LAN protocol because a MANET protocol will

### Answer

consume less power than a typical LAN protocol.

### Question 5

The function of a packet header is to

### Answer

contain packet information generated by a protocol layer.

### Question 6

A packet sniffer is a tool that can be used to record local traffic on a network.

### Answer

True

### Question 7

A hub can be used to communicate between two LANs with different protocols.

### Answer

False

### Question 8

In the HTTP protocol, a request message is sent by a web client to a web server.

### Answer

True
<file_sep>def calc_fib(n):

    f = [0, 1]
    for i in range(2, 61):
        f.insert(i, (f[i-1] + f[i-2]) % 10)
    rem = n % 60
    quotient =  (n - rem) / 60
    return int((sum(f) * quotient + sum(f[0: rem+1])) % 10)

n = int(input())
print(calc_fib(n))
<file_sep>## Quiz

### Question 1

Which component is not contained on the Raspberry Pi B+ board?

### Answer

Analog-to-Digital converter

### Question 2

An ARM-based processor is

### Answer

A processor which contains a core designed by ARM Ltd.

### Question 3

Which of the following is not a task of an operating system?

### Answer

Improve performance by increasing clock frequency of the processor

### Question 4

Which feature of the Raspberry Pi tends to make it seem like it is not an IoT device?

### Answer

It provides a graphic interface using a keyboard, monitor and mouse

### Question 5

Once the Raspberry Pi has been configured, what must be contained on the micro SD card?

### Answer

The operating system

### Question 6

Which of the following is not an impact of overclocking?

### Answer

Improved temperature profile

### Question 7

raspi-config can only be used during the initial setup.

### Answer

False

### Question 8

The Raspberry Pi can be configured to boot directly to the desktop

### Answer

True
<file_sep>## Quiz

### Question 1

Which Arduino function can be used to read information from a sensor?

### Answer

digitalRead()

### Question 2

A photoresistor:

### Answer

changes resistance according to light level

### Question 3

A voltage divider is:

### Answer

a circuit that contains resistors connected in series

### Question 4

True or False: A voltage-controlling sensor can be read by an Arduino using the analogRead() function.

### Answer

True

### Question 5

In order to perform On-Off actuation, the following Arduino command might be used:

### Answer

digitalWrite()

### Question 6

The function of a Digital to Analog Converter is:

### Answer

to generate an analog voltage from digital signals

### Question 7

Which Arduino command is used to generate a pulse width modulated signal?

### Answer

analogWrite()

### Question 8

The duty cycle of a signal describes:

### Answer

the fraction of time it is high
<file_sep># Converting a wired Canon printer into wireless using a Raspberry Pi

![Printer](./Resources/printer.jpeg)

## Requirement specification document:

At my house, I have the Canon PIXMA MG2470 All-in-One Inkjet Printer and it annoys me a lot when I have to print something, I have to carry my laptop to the living room to plug it into the printer and keep standing there until it is done printing, sometimes it takes a long time if there are a lot of pages and the printer is not very fast, especially if I have to print a coloured image or printout.

And then I got an idea after completing this specialization, I can turn it into a wireless printer using a Raspberry Pi instead of buying a new Wireless printer which will most probably cost around $200 - $300, whereas buying a Raspberry Pi with required equipment will be around \$50.

What I used was a $35 Raspberry Pi 4, and a $5 packet containing resistors and LED’s because I had already had a SD card on which I loaded Raspbian and some solder and other electrical stuff that I already had lying around at the house.

## What the user has to do:

• Download the software required for the printer.

![Software](./Resources/software.jpg)

• Choose the document to print.

• And select the printer. It will be available wirelessly if the user is connected to the same Wi-Fi.

## What I, as a developer have to do:

• Raspberry Pi should receive the file using Sockets and forward it to the printer.

• Order should be maintained i.e. Image that is received first should be printed first.

• File transfer speed should be fast so as to make the printing feasible and actually helpful. The file transfer speed should not depend on the internet speed.
<file_sep>This is my first repository.
A repository is a location where all the files of a particular project are stored

This is basically the only file that is to be created in the linux instance.
But there are few basic git commands to be performed in the terminal.<file_sep># Quiz

### Que 1

You are developing an application that transcodes large video files. Which storage option is the best choice for your application?

### Answer

Cloud Storage

### Que 2

You manufacture devices with sensors and need to stream huge amounts of data from these devices to a storage option in the cloud. Which Google Cloud Platform storage option is the best choice for your application?

### Answer

Cloud Bigtable

### Que 3

Which statement is true about objects in Cloud Storage?

### Answer

They are immutable, and new versions overwrite old unless you turn on versioning.

### Que 4

You are building a small application. If possible, you'd like this application's data storage to be at no additional charge. Which service has a free daily quota, separate from any free trials?

### Answer

Cloud Datastore

### Que 5

How do the Nearline and Coldline storage classes differ from Multi-regional and Regional? Choose all that are correct (2 responses).

### Answer

    Nearline and Coldline assess additional retrieval fees.
    Nearline and Coldline assess lower storage fees.

### Que 6

Your application needs a relational database, and it expects to talk to MySQL. Which storage option is the best choice for your application?

### Answer

Cloud SQL

### Que 7

Your application needs to store data with strong transactional consistency, and you want seamless scaling up. Which storage option is the best choice for your application?

### Answer

Cloud Spanner

### Que 8

Which GCP storage service is often the ingestion point for data being moved into the cloud, and is frequently the long-term storage location for data?

### Answer

Cloud Storage
<file_sep># Quiz

### Que 1

Identify two reasons for deploying applications using containers. (Choose 2 responses.)

### Answer

    Consistency across development, testing, production environments
    Simpler to migrate workloads

### Que 2

True or False: Kubernetes allows you to manage container clusters in multiple cloud providers.

### Answer

True

### Que 3

True or False: Google Cloud Platform provides a secure, high-speed container image storage service for use with Kubernetes Engine.

### Answer

True

### Que 4

In Kubernetes, what does "pod" refer to?

### Answer

A group of containers that work together

### Que 5

Does Google Cloud Platform offer its own tool for building containers (other than the ordinary docker command)?

### Answer

Yes; the GCP-provided tool is an option, but customers may choose not use it.

### Que 6

Where do your Kubernetes Engine workloads run?

### Answer

In clusters built from Compute Engine virtual machines
<file_sep>## Quiz

### Question 1

What is the name of the Python package used to control the Raspberry Pi camera module?

### Answer

picamera

### Question 2

What function in the camera library is used to take a picture?

### Answer

capture()

### Question 3

What is a “duty cycle”?

### Answer

The fraction of time a square wave is high

### Question 4

Why is pulse width modulation useful?

### Answer

It can be used to mimic an analog signal

### Question 5

How many input wires does a servo have?

### Answer

3

### Question 6

Why is it common to use an external power supply to drive a servo?

### Answer

A servo needs more current than a microcontroller can provide

### Question 7

The CSI camera interface of the Raspberry Pi needs to be activated before using the camera module.

### Answer

True

### Question 8

The speed of a servo motor is easily controlled.

### Answer

False
<file_sep># Quiz

### Que 1

Which compute service lets customers run virtual machines that run on Google's infrastructure?

### Answer

Compute Engine

### Que 2

Which compute service lets customers deploy their applications in containers that run in clusters on Google's infrastructure?

### Answer

Kubernetes Engine

### Que 3

Which compute service lets customers focus on their applications, leaving most infrastructure and provisioning to Google, while still offering various choices of runtime?

### Answer

App Engine

### Que 4

Which compute service lets customers supply chunks of code, which get run on-demand in response to events, on infrastructure wholly managed by Google?

### Answer

Cloud Functions

### Que 5

For what kind of traffic would the regional load balancer be the first choice? Choose all that are correct (2 answers).

### Answer

    UDP traffic
    TCP traffic on arbitrary port numbers

### Que 6

Choose a simple way to let a VPN into your Google VPC continue to work in spite of routing changes,

### Answer

Cloud Router

### Que 7

Which of these storage needs is best addressed by Cloud Datastore?

### Answer

Structured objects, with transactions and SQL-like queries

### Que 8

Which of these storage needs is best addressed by Cloud Spanner?

### Answer

A relational database with SQL queries and horizontal scalability

### Que 9

Which of these storage needs is best addressed by Cloud Bigtable?

### Answer

Structured objects, with lookups based on a single key

### Que 10

Which of these storage needs is best addressed by Cloud Storage?

### Answer

Immutable binary objects
<file_sep># Quiz

### Que 1

You want a secure, private connection between your network and a Google Cloud network. There is not a lot of volume, but the connection needs to be extremely reliable. Which configuration below would you choose?

### Answer

VPN with high availability and Cloud Router.

### Que 2

You have a contract with a service provider to manage your Google VPC networks. You want to connect a network they own to your VPC. Both networks are in Google Cloud. Which Connection option should you choose?

### Answer

VPC peering

### Que 3

You are a large bank deploying an online banking service to Google Cloud. The service needs high volume access to mainframe data on-premises. Which connectivity option would likely be best?

### Answer

Cloud Interconnect

### Que 4

You are deploying a large-scale web application with users all over the world and a lot of static content. Which load balancer configuration would likely be the best?

### Answer

HTTP load balancer with SSL configured and the CDN enabled.
<file_sep>## Quiz

### Question 1

How many pins does the Raspberry Pi B+ have?

### Answer

40

### Question 2

How many GPIO pins are dedicated to the SPI protocol?

### Answer

5

### Question 3

What voltage level is associated with HIGH on the GPIO of the Raspberry Pi?

### Answer

3.3

### Question 4

What function determines the numbering of the pins used?

### Answer

GPIO.setmode()

### Question 5

What function determines whether a pin will be used as an input or an output?

### Answer

GPIO.setup()

### Question 6

What function is used to set a pin to a value?

### Answer

GPIO.output()

### Question 7

What function is used to read a digital value on a pin?

### Answer

GPIO.input()

### Question 8

What function is used to read an analog value on a pin?

### Answer

None of the above
<file_sep>## Quiz

### Question 1

Pressure in a water pump system is analogous to what concept in an electrical circuit?

### Answer

voltage

### Question 2

A narrow pipe in a water system is analogous to what concept in an electrical circuit?

### Answer

resistance

### Question 3

Electrical current is measured in:

### Answer

Amperes

### Question 4

Electrical resistance is measured in:

### Answer

Ohms

### Question 5

An LED is reverse-biased when:

### Answer

the anode is negative with respect to the cathode

### Question 6

The function of a potentiometer is to:

### Answer

vary the resistance between points in the circuit

### Question 7

True or False: All of the holes in a column on the side of a breadboard are electrically connected.

### Answer

True

### Question 8

True or False: When resistance increases and current is held constant, voltage also increases.

### Answer

True
<file_sep># Week 4 Quiz

### Question

In row 1 of the following spreadsheet, the words rank, name, population, and county are called what?

![Image1](Images/1.PNG)

### Answer

Attributes

### Question

In the following spreadsheet, the observation of Greensboro describes all of the data in row 4.

![Image2](Images/1.PNG)

### Answer

True

### Question

If a data analyst wants to list the cities in this spreadsheet alphabetically, instead of numerically, what feature can they use in column B?

![Image3](Images/1.PNG)

### Answer

Sort range

### Question

A data analyst types =POPULATION(C2:C11) to find the average population of the cities in this spreadsheet. However, they realize that have used the wrong formula. What syntax will correct this function?

![Image4](Images/1.PNG)

### Answer

=AVERAGE(C2:C11)

### Question

In the following query, FROM is telling the database to filter out data from the Orders table.

![Image5](Images/5.PNG)

### Answer

False

### Question

You are writing a query that asks a database to retrieve data about the customer with identification number 244. The column name for customer identification numbers is customer_id. What is the correct SQL clause?

### Answer

WHERE customer_id = 244

### Question

A data analyst creates the following visualization to clearly demonstrate how much more populous Charlotte is than the next-largest North Carolina city, Raleigh. It’s called a line chart.

![Image6](Images/7.PNG)

### Answer

False

### Question

A data analyst wants to demonstrate a trend of how something has changed over time. What type of chart is best for this task?

### Answer

Line

### Question

Fill in the blank: In row 8 of the following spreadsheet, you can find the **\_** of Cary.

![Image7](Images/1.PNG)

### Answer

observation

### Question

In the following query, what does FROM tell the database?

![Image9](Images/5.PNG)

### Answer

From which table to select data

### Question

Fill in the blank: A data analyst creates a table, but they realize this isn’t the best visualization for their data. To fix the problem, they decide to use the **\_** feature to change it to a column chart.

### Answer

chart editor

### Question

A data analyst wants to demonstrate how the population in Charlotte has increased over time. They create the chart below. What is this type of chart called?

![Image10](Images/8.PNG)

### Answer

Line chart

### Question

A data analyst wants to demonstrate how the population in Charlotte has increased over time. They create this data visualization. This is an example of an area chart.

![Image11](Images/8.PNG)

### Answer

False
<file_sep># Quiz

### Que 1

Your service has an availability SLO of 99%. What could you use to monitor whether you are meeting it?

### Answer

Uptime check

### Que 2

You're deploying test environments using Compute Engine VMs. Some downtime is acceptable, and it is very important to deploy them as inexpensively as possible. What single thing below could save you the most money?

### Answer

Preemptible machines

### Que 3

You made a minor update to a service and would like to test it in production by sending a small portion of requests to the new version. Which would you choose?

### Answer

Canary deployment

### Que 4

You've made a minor fix to one of your services. You want to deploy the new version with no downtime. Which would you choose?

### Answer

Rolling update
<file_sep># Quiz

### Que 1

Which best describes an SLO?

### Answer

It is a target reliability you want your service to achieve.

### Que 2

Using SMART criteria, which below would be the least effective KPI?

### Answer

User experience design

### Que 3

Which best describes a user story?

### Answer

It is a short description of a feature written from the user's point of view.
<file_sep># Week 3 Quiz

### Question 1
Fill in the blanks of this code to print out the numbers 1 through 7
### Answer
```
number = 1
while number <= 7:
	print(number, end=" ")
	number+=1
```

### Question 2
The show_letters function should print out each letter of a word on a separate line. Fill in the blanks to make that happen.
### Answer
```
def show_letters(word):
	for i in word:
		print(i)

show_letters("Hello")
# Should print one line per letter
```

### Question 3
Complete the function digits(n) that returns how many digits the number has. For example: 25 has 2 digits and 144 has 3 digits. Tip: you can figure out the digits of a number by dividing it by 10 once per digit until there are no digits left.
### Answer
```
def digits(n):
	count=len(str(n))
	return count
	
print(digits(25))   # Should print 2
print(digits(144))  # Should print 3
print(digits(1000)) # Should print 4
print(digits(0))    # Should print 1
```

### Question 4
This function prints out a multiplication table (where each number is the result of multiplying the first number of its row by the number at the top of its column). Fill in the blanks so that calling multiplication_table(1, 3) will print out:

    1 2 3
    2 4 6
    3 6 9
### Answer
``` 
def multiplication_table(start, stop):
	for x in range(stop):
		for y in range(stop):
			print(str((x+1)*(y+1)), end=" ")
		print()

multiplication_table(1, 3)
# Should print the multiplication table shown above
```

### Question 5
The counter function counts down from start to stop when start is bigger than stop, and counts up from start to stop otherwise. Fill in the blanks to make this work correctly.
### Answer
```
def counter(start, stop):
	x=start
	if start<=stop:
		string="Counting up: "
		while x <=stop:
			string+=str(x)
			if x!=stop:
				string+=","
			x+=1
	else:
		string="Counting down: "
		while x >=stop:
			string+=str(x)
			if x!=stop:
				string+=","
			x-=1
	return string
print(counter(1, 10)) # Should be "Counting up: 1,2,3,4,5,6,7,8,9,10"
print(counter(2, 1)) # Should be "Counting down: 2,1"
print(counter(5, 5)) # Should be "Counting up: 5"
```

### Question 6
The even_numbers function returns a space-separated string of all positive numbers that are divisible by 2, up to and including the maximum that's passed into the function. For example, even_numbers(6) returns “2 4 6”. Fill in the blank to make this work.
### Answer
```
def even_numbers(maximum):
	return_string = ""
	for x in range(2,maximum+1,2):
		return_string += str(x) + " "
	return return_string.strip()

print(even_numbers(6))  # Should be 2 4 6
print(even_numbers(10)) # Should be 2 4 6 8 10
print(even_numbers(1))  # No numbers displayed
print(even_numbers(3))  # Should be 2
print(even_numbers(0))  # No numbers displayed
```

### Question 7
The following code raises an error when executed. What's the reason for the error?
```
def decade_counter():
	while year < 50:
		year += 10
	return year
```
### Answer
Failure to initialize variables

### Question 8
What is the value of x at the end of the following code?
```
for x in range(1, 10, 3):
    print(x)
```
### Answer
7

### Question 9
What is the value of y at the end of the following code?
```
for x in range(10):
    for y in range(x):
        print(y)
```
### Answer
8

### Question 10
How does this function need to be called to print yes, no, and maybe as possible options to vote for?
```
def votes(params):
	for vote in params:
	    print("Possible option:" + vote)

```
### Answer
`votes(['yes', 'no', 'maybe'])`
<file_sep>## Quiz

### Question 1

What is a difference between clients and servers on the Internet?

### Answer

Clients initiate requests for service

### Question 2

What Python function is used to perform a DNS lookup?

### Answer

gethostbyname()

### Question 3

What Python function is used by the client to establish a connection between sockets?

### Answer

connect()

### Question 4

The recv() function performs a non-blocking wait, by default.

### Answer

False

### Question 5

When is the code inside an except clause executed?

### Answer

When code inside the associated try clause causes an appropriate exception

### Question 6

Binding a socket on the server-side requires what information?

### Answer

The port number for communication

### Question 7

What is a “live” server?

### Answer

A server that serves many requests over a long time

### Question 8

Sockets can be used to communicate between two Raspberry Pis.

### Answer

True
<file_sep>## This repo contains the solutions to all the courses that I have completed on Coursera.
### Some folders are individual courses while others are Specializations.

## NOTE:
### This repo does not contain the notes or documents provided during the course, only the solutions.<file_sep>## Quiz

### Question 1

What is the name of the library which contains the printf() function?

### Answer

stdio.h

### Question 2

What does the '\n' character mean?

### Answer

newline

### Question 3

What type of data is surrounded by double quotes in a program?

### Answer

A string

### Question 4

What C type is one byte long?

### Answer

char

### Question 5

Does the following statement evaluate to True or False?

`(10 || (5-2)) && ((6 / 2) - (1 + 2))`

### Answer

False

### Question 6

What does the following program print to the screen?

```
int main (){
   int x = 0, y = 1;
   if (x || !y)
  	printf("1");
   else if (y && x)
  	printf("2");
   else
  	printf("3");
}
```

### Answer

3

### Question 7

What does the following program print to the screen?

```
int main (){
   int x = 0, z = 2;
   while (x < 3) {
  	printf ("%i ", x);
      x = x + z;
    }
}
```

### Answer

0 2

### Question 8

What does the following program print to the screen?

```
int foo (int q) {
    int x = 1;
    return (q + x);
}
int main (){
   int x = 0;
   while (x < 3) {
  	printf ("%i ", x);
      x = x + foo(x);
    }
}
```

### Answer

0 1
<file_sep># This function creates a special object of type matrix that can cache its inverse
makeCacheMatrix <- function(x = numeric()) {
  inv <- NULL
  get <- function() x
  getInverse <- function() {
    if(length(x)%%sqrt(length(x))==0) {
      # making sure that matrix is n x n
      inv <<- solve(x)
    }
  }
  list(get = get, getInverse = getInverse)
}

if (FALSE){
  'This function takes the matrix object created by the function written above 
  and calculates its inverse. If the matrix and its inverse are equal then this
  function retrieves the inverse stored in the cache!!'
}

cacheSolve <- function(x, ...) {
  if(!is.atomic(x)){
    # checks if the given parameter is atomic
    inv <- x$getInverse()
    if(!is.null(inv)) {
      message('getting cached data')
      return(inv)
    }     
  } else {       
    # Converts it to atomic if it's not already
    message('getting the inverse-- no cached data found')
    return(makeCacheMatrix(x)$getInverse())
  } 
  
}

# non-atomic example
f <- makeCacheMatrix(matrix(1:4, 2, 2))
print(cacheSolve(f))

# atomic examples
print(cacheSolve(matrix(1:4, 2, 2)))<file_sep># Quiz

### Que 1

What is the purpose of Virtual Private Networking (VPN)?

### Answer

To enable a secure communication method (a tunnel) to connect two trusted environments through an untrusted environment, such as the Internet.

### Que 2

Which GCP Interconnect service requires a connection in a GCP colocation facility and provides 10 Gbps per link?

### Answer

Dedicated Interconnect

### Que 3

If you cannot meet Google’s peering requirements, which network connection service should you choose to connect to Google Workspace and YouTube?

### Answer

Carrier Peering

### Que 4

Which of the following approaches to multi-project networking, uses a centralized network administration model?

### Answer

Shared VPC
<file_sep>## Applied Data Science with Python Specialization offered by Univeristy of Michigan

### This module contains the solutions from the courses that I have completed in the above mentioned Specialization.<file_sep># Week 1 Quiz

### Question 1
What is a computer program?
### Answer
A step-by-step recipe of what needs to be done to complete a task, that gets executed by the computer.

### Question 2
What’s automation?
### Answer
The process of replacing a manual step with one that happens automatically.

### Question 3
Which of the following tasks are good candidates for automation? Check all that apply.
### Answer
    Creating a report of how much each sales person has sold in the last month.

    Setting the home directory and access permissions for new employees joining your company.

    Populating your company's e-commerce site with the latest products in the catalog.

### Question 4
What are some characteristics of the Python programming language? Check all that apply
### Answer
    Python programs are easy to write and understand.

    The Python interpreter reads our code and transforms it into computer instructions.

    We can practice Python using web interpreters or codepads as well as executing it locally.

### Question 5
How does Python compare to other programming languages?
### Answer
Each programming language has its advantages and disadvantages

### Question 6
Write a Python script that outputs "Automating with Python is fun!" to the screen.
### Answer
`print("Automating with Python is fun!")`

### Question 7
Fill in the blanks so that the code prints "Yellow is the color of sunshine".
### Answer
```
color = 'Yellow'
thing = 'sunshine'
print(color + " is the color of " + thing)
```

### Question 8
Keeping in mind there are 86400 seconds per day, write a program that calculates how many seconds there are in a week, if a week is 7 days. Print the result on the screen.

Note: Your result should be in the format of just a number, not a sentence.
### Answer
`print(86400*7)`

### Question 9
Use Python to calculate how many different passwords can be formed with 6 lower case English letters. For a 1 letter password, there would be 26 possibilities. For a 2 letter password, each letter is independent of the other, so there would be 26 times 26 possibilities. Using this information, print the amount of possible passwords that can be formed with 6 letters.
### Answer
`print(26**6)`
### Question 10
Most hard drives are divided into sectors of 512 bytes each. Our disk has a size of 16 GB. Fill in the blank to calculate how many sectors the disk has.

Note: Your result should be in the format of just a number, not a sentence.
### Answer
```
disk_size = 16*1024*1024*1024
sector_size = 512
sector_amount = disk_size/sector_size

print(sector_amount)
```
<file_sep>#include <stdio.h>

void main()
{
    int arr[6];
    arr[0] = 0;
    arr[1] = 1;
    for (int i = 2; i < 6; i++)
    {
        arr[i] = arr[i - 1] + arr[i - 2];
    }
    for (int i = 0; i < 6; i++)
    {
        printf("%d ", arr[i]);
    }
}<file_sep>import math


def change(amount):
    denominations_10 = math.floor(amount / 10)
    denominations_5 = math.floor((amount - denominations_10 * 10) / 5)
    denominations_1 = amount - (denominations_10 * 10 + denominations_5 * 5)
    return denominations_1 + denominations_5 + denominations_10


if __name__ == '__main__':
    amount = int(input())
    print(change(amount))
<file_sep># Quiz

### Que 1

What’s the benefit of writing templates for your Deployment Manager configuration?

### Answer

Allows you to abstract part of your configuration into individual building blocks that you can reuse

### Que 2

What does Google Cloud Platform Marketplace offer?

### Answer

Production-grade solutions from third-party vendors who have already created their own deployment configurations based on Deployment Manager
<file_sep>import http.client
conn = http.client.HTTPSConnection("www.uci.edu")
conn.request("GET", "/")
resp = conn.getresponse()
content = resp.read(1000)
print(content)
conn.close()
<file_sep># Guided Projects

## Guided projects are projects on Coursera that take only hours to complete. So there are no weeks just one quiz or assignment in each project.<file_sep># Quiz

### Que 1

Name two use cases for Google Cloud Dataproc (Select 2 answers).

### Answer

    Data mining and analysis in datasets of known size
    Migrate on-premises Hadoop jobs to the cloud

### Que 2

Name two use cases for Google Cloud Dataflow (Select 2 answers).

### Answer

    Orchestration
    Extract, Transform, and Load (ETL)

### Que 3

Name three use cases for the Google Cloud Machine Learning Platform (Select 3 answers).

### Answer

    Content personalization
    Sentiment analysis
    Fraud detection

### Que 4

Which statements are true about BigQuery? Choose all that are true (2 statements).

### Answer

    BigQuery is a good choice for data analytics warehousing.
    BigQuery lets you run fast SQL queries against large databases.

### Que 5

Name three use cases for Cloud Pub/Sub (Select 3 answers).

### Answer

    Analyzing streaming data
    Decoupling systems
    Internet of Things applications

### Que 6

What is TensorFlow?

### Answer

An open-source software library that’s useful for building machine learning applications

### Que 7

What does the Cloud Natural Language API do?

### Answer

It analyzes text to reveal its structure and meaning.
<file_sep># Quiz

### Question 1
Selenium library files are included in the java project as ?
### Answer
    External Jar File

### Question 2
Which method can navigate you to a particular URL?
### Answer
    driver.get(url); where driver is a browser instance

### Question 3
What is the difference between driver.close() and driver.quit() methods in Selenium?
### Answer
    driver.close() method closes the currently active window and driver.quit() method closes all the opened windows

### Question 4
Which of the following is not a valid locator in Selenium?
### Answer
    Id, textbox, value

### Question 5
To verify the actual results with expected results, TestNG has?
### Answer
    Assert Statement

### Question 6
To click a radio button or a normal button, which of the following is a valid action in Selenium?
### Answer
    element.click(); where element is WebElement
    
### Question 7
Which of the following is possibly a correct Xpath?
### Answer
    //table[@id='customer']/tbody/td


<file_sep># Quiz

### Que 1

What Google Cloud feature would be easiest to use to automate a build in response to code being checked into your source code repository?

### Answer

Build triggers

### Que 2

Which Google Cloud tools can be used to build a continuous integration pipeline?

### Answer

All of the these
<file_sep># Week 3 Quiz

### Question 1
Take a look at the 'iris' dataset that comes with R. The data can be loaded with the code:
```
library(datasets)
data(iris)
```
A description of the dataset can be found by running

```?iris```

There will be an object called 'iris' in your workspace. In this dataset, what is the mean of 'Sepal.Length' for the species virginica? Please round your answer to the nearest whole number.
### Code
```
library(datasets)
data(iris)
?iris
mean(iris[iris$Species == "virginica",]$Sepal.Length)
[1] 6.588
```
### Answer
6.588 rounded off becomes 7

### Question 2
Continuing with the 'iris' dataset from the previous Question, what R code returns a vector of the means of the variables 'Sepal.Length', 'Sepal.Width', 'Petal.Length', and 'Petal.Width'?
### Code
```
library(datasets)
data(iris)
apply(iris[, 1:4], 2, mean)
Sepal.Length  Sepal.Width Petal.Length  Petal.Width 
    5.843333     3.057333     3.758000     1.199333 
```
### Answer
apply(iris[, 1:4], 2, mean)

### Question 3
Load the 'mtcars' dataset in R with the following code
```
library(datasets)
data(mtcars)
```
There will be an object names 'mtcars' in your workspace. You can find some information about the dataset by running

```?mtcars```
### Answer
        sapply(split(mtcars$mpg, mtcars$cyl), mean)
        with(mtcars, tapply(mpg, cyl, mean))
        tapply(mtcars$mpg,mtcars$cyl, mean)

### Question 4
Continuing with the 'mtcars' dataset from the previous Question, what is the absolute difference between the average horsepower of 4-cylinder cars and the average horsepower of 8-cylinder cars?

(Please round your final answer to the nearest whole number. Only enter the numeric result and nothing else.)
### Code
```
library(datasets)
data(mtcars)
mean(mtcars[mtcars$cyl == "8",]$hp) - mean(mtcars[mtcars$cyl == "4",]$hp)
[1] 126.5779
```
### Answer
126.5779 rounded off becomes 127

### Question 5
If you run
```
debug(ls)
```
what happens when you next call the 'ls' function?
### Answer
Execution of 'ls' will suspend at the beginning of the function and you will be in the browser.<file_sep>## There's no code to be shared for week 3.

## The only hint I have is that when you are asked to create the instances using instance template and the steps tell you to run the code on your local machine that means that you have to run those lines of code in the cloud shell, which can be accessed using the terminal resembling icon near the bell icon on top right corner.
<file_sep>#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int ad_revenue(int num, vector<int> &profit, vector<int> &clicks)
{
    int revenue = 0;
    sort(profit.begin(), profit.end());
    sort(clicks.begin(), clicks.end());
    for (int i = 0; i < num; i++)
    {
        revenue += profit[i] * clicks[i];
    }
    return revenue;
}

int main()
{
    int num, temp;
    cin >> num;
    vector<int> profit;
    vector<int> clicks;
    for (int i = 0; i < num; i++)
    {
        cin >> temp;
        profit.push_back(temp);
    }
    for (int i = 0; i < num; i++)
    {
        cin >> temp;
        clicks.push_back(temp);
    }
    cout << ad_revenue(num, profit, clicks) << "\n";
    return 0;
}
<file_sep>#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

long long fibonacci_sum_last_digit(long long m, long long n) {
    vector<int> f;
    f.push_back(0);
    f.push_back(1);
    for (int i = 2; i <= 60; i++){
        f.push_back((f[i-1] + f[i-2]) % 10);
    }
    long long rem1 = m % 60;
    long long quotient1 = (m - rem1) / 60;
    long long rem2 = n % 60;
    long long quotient2 = (n - rem2) / 60;
    long long sum1 = accumulate(f.begin() + rem1, f.end(), 0);
    long long sum2 = accumulate(f.begin(), f.begin() + rem2 + 1, 0);
    long long sum3 = accumulate(f.begin(), f.end(), 0) *  (quotient2 - (quotient1 + 1));
    return (sum1 + sum2 +sum3) % 10; 
}

int main() {
    long long m, n;
    cin >> m >> n;
    cout << fibonacci_sum_last_digit(m, n) << '\n';
    return 0;
}
<file_sep>#!/usr/bin/env python3
import os
from PIL import Image

# path = os.path.expanduser('~') + '/supplier-data/images/'
path = 'supplier-data/images/'

for file in os.listdir(path):
    if '.tiff' in file:
        img = Image.open(path + file).convert("RGB")
        dir, filename = os.path.split(file)
        # get filename without extension
        filename = os.path.splitext(filename)[0]
        img.resize((600, 400)).save(path + filename + '.jpeg', 'jpeg')
<file_sep># Week 1 Quiz

### Question 1 
Python is an example of an
### Answer
Interpreted Language

### Question 2
Data Science is a
### Answer
Interdisciplinary, made up of all of the above

### Question 3 
Data visualization is not a part of data science.
### Answer
False

### Question 4 
Which bracketing style does Python use for tuples?
### Answer
( )

### Question 5 
In Python, strings are considered Mutable, and can be changed.
### Answer
False

### Question 6 
What is the result of the following code: `['a', 'b', 'c'] + [1, 2, 3]`
### Answer
`['a', 'b', 'c', 1, 2, 3]`

### Question 7 
String slicing is
### Answer
A way to make a substring of a string in python

### Question 8 
When you create a lambda, what type is returned? E.g. `type(lambda x: x+1)` returns
### Answer
`<class 'function'>`

### Question 9 
The epoch refers to
### Answer
January 1, year 1970

### Question 10 
This code, `[x**2 for x in range(10)]` , is an example of a
### Answer
List Comprehension

### Question 11
Given a 6x6 NumPy array r, which of the following options would slice the shaded elements?

![Matrix](./11.png)
### Answer
`r.reshape(36)[::7]`

### Question 12
Given a 6x6 NumPy array r, which of the following options would slice the shaded elements?

![Matrix](./11.png)
### Answer
`r[2:4,2:4]`
<file_sep># Week 1 Quiz

### Question

Which of the following options describes data analysis?

### Answer

The collection, transformation, and organization of data in order to draw conclusions, make predictions, and drive informed decision-making.

### Question

In data analytics, a model is a group of elements that interact with one another.

### Answer

False

### Question

What tactics can a data analyst use to effectively blend gut instinct with facts? Select all that apply.

### Answer

    Use their knowledge of how their company works to better understand a business need.
    Apply their unique past experiences to their current work, while keeping in mind the story the data is telling.

### Question

A furniture manufacturer wants to find a more environmentally friendly way to make its products. A data analyst helps solve this problem by gathering relevant data, analyzing it, and using it to draw conclusions. The analyst then shares their analysis with subject-matter experts from the manufacturing team, who validate the findings. Finally, a plan is put into action. This scenario describes data science.

### Answer

False

### Question

To get the most out of data-driven decision-making, it’s important to include insights from people very familiar with the business problem. Identify what these people are called.

### Answer

Subject-matter experts

### Question

You have just finished analyzing data for a marketing project. Before moving forward, you share your results with members of the marketing team to see if they might have additional insights into the business problem. What practice does this support?

### Answer

Data-driven decision-making

### Question

You have recently subscribed to an online data analytics magazine. You really enjoyed an article and want to share it in the discussion forum. Which of the following would be appropriate in a post? Select all that apply.

### Answer

    Checking your post for typos or grammatical errors
    Giving credit to the original author
    Including your own thoughts about the article

### Question

Data analysis is the various elements that interact with one another in order to provide, manage, store, organize, analyze, and share data.

### Answer

False

### Question

Fill in the blank: Data ecosystems are made up of elements that **\_** with each other. This makes it possible for them to produce, manage, store, organize, analyze, and share data.

### Answer

interact

### Question

Select the best description of gut instinct.

### Answer

An intuitive understanding of something with little or no explanation

### Question

You read an interesting article about data analytics in a magazine and want to share some ideas from the article in the discussion forum. In your post, you include the author and a link to the original article. This would be an inappropriate use of the forum.

### Answer

False

### Question

A company defines a problem it wants to solve. Then, a data analyst gathers relevant data, analyzes it, and uses it to draw conclusions. The analyst shares their analysis with subject-matter experts, who validate the findings. Finally, a plan is put into action. What does this scenario describe?

### Answer

Data-driven decision-making

### Question

What do subject-matter experts do to support data-driven decision-making? Select all that apply.

### Answer

    Validate the choices made as a result of the data insights
    Review the results of data analysis and identify any inconsistencies
    Offer insights into the business problem

### Question

Sharing the results of your analysis with colleagues who are very familiar with the business problem supports what practice?

### Answer

Data-driven decision-making

### Question

Fill in the blank: The term **\_** is defined as an intuitive understanding of something with little or no explanation.

### Answer

gut instinct

### Question

Fill in the blank: The people very familiar with a business problem are called **\_**. They are an important part of data-driven decision-making.

### Answer

subject-matter experts

### Question

The collection, transformation, and organization of data in order to draw conclusions, make predictions, and drive informed decision-making describes what?

### Answer

Data analysis

### Question

In data analytics, what term describes a collection of elements that interact with one another?

### Answer

A data ecosystem

### Question

Fill in the blank: Data **\_** involves creating new ways of modeling and understanding the unknown by using raw data.

### Answer

science
<file_sep># Quiz

### Question 1
The libraries that we need to import are:

    numpy as bp
    matplotlib.pyplot as plt
    cv2
### Answer
False

### Question 2
The main points that we must remember when we work with OpenCV are:
### Answer
Three

### Question 3
If we want to draw a shape and fill it inside we must write:
### Answer
-1

### Question 4
We can draw shapes by coding the coordinates of the shape we want to draw and we can draw shapes with the mouse.
### Answer
True

### Question 5
We have opend an image with Matplotlib.pyplot and we want to remove only the Blue channel. Our code will be:
### Answer
[:, :, 2] = -1

### Question 6
We can only draw on specific points on an image. We cannot draw shapes by moving our mouse.
### Answer
False

### Question 7
We are working with OpenCV and we want to draw a straight line on our image. How many points do we need to use?
### Answer
2

### Question 8
We have opened an image with OpenCV. We want to flip it on both Vertical and Horizontal axis. Which is correct the code ?
### Answer
cv2.flip(img, -1)

### Question 9
We can draw with a mouse but we cannot give functionallity to both buttons of the mouse.
### Answer
False
<file_sep>## Quiz

### Question 1

What does the ‘sudo’ command do?

### Answer

Allows a command to execute with root permission

### Question 2

What command shows a list of running processes?

### Answer

ps

### Question 3

What command prints out the contents of a directory?

### Answer

ls

### Question 4

What command creates a new directory?

### Answer

mkdir

### Question 5

What command should be used before powering off the machine?

### Answer

shutdown

### Question 6

What is the username of the non-root account created when Raspian is installed?

### Answer

pi

### Question 7

What command starts the graphic user interface from the shell after booting the Raspberry Pi?

### Answer

startx

### Question 8

The Raspberry Pi comes with Linux pre-installed?

### Answer

False
<file_sep># Quiz

### Que 1

You've been asked to write a program that uses Vision API to check for inappropriate content in photos that are uploaded to a Cloud Storage bucket. Any photos that are inappropriate should be deleted. What might be the simplest, cheapest way to deploy in this program?

### Answer

Cloud Functions

### Que 2

You have containerized multiple applications using Docker and have deployed them using Compute Engine VMs. You want to save cost and simplify container management. What might you do.

### Answer

Migrate the containers to GKE.

### Que 3

You need to deploy an existing application that was written in .NET version 4. The application requires Windows servers, and you don't want to change it. Which should you use?

### Answer

Compute Engine
<file_sep>def ad_revenue(num, profit, clicks):
    profit.sort()
    clicks.sort()
    revenue = 0
    for i in range(num):
        revenue += profit[i] * clicks[i]
    return revenue


if __name__ == '__main__':
    num = int(input())
    profit = [int(x) for x in input().split()]
    clicks = [int(x) for x in input().split()]
    print(ad_revenue(num, profit, clicks))
<file_sep># Week 1 Quiz

### Question

Organizing available information and revealing gaps and opportunities are part of what process?

### Answer

Using structured thinking

### Question

While creating data visualizations for a slideshow, a data analyst considers, “What would help a stakeholder understand this data better?” The analyst is in the analyze step of the data analysis process.

### Answer

False

### Question

A garden center wants to attract more customers. A data analyst in the marketing department suggests advertising in popular landscaping magazines. This is an example of what practice?

### Answer

Reaching your target audience

### Question

A company wants to make more informed decisions regarding next year’s business strategy. An analyst uses data to help identify how things will likely work out in the future. This is an example of which problem type?

### Answer

Making predictions

### Question

Describe the key difference between the problem types of categorizing things and identifying themes.

### Answer

Categorizing things involves assigning items to categories. Identifying themes takes those categories a step further, grouping them into broader themes.

### Question

Which of the following examples are leading questions? Select all that apply.

### Answer

    How satisfied were you with our customer representative
    In what ways did our product meet your needs?
    What do you enjoy most about our service?

### Question

The question, “How could we improve our website to simplify the returns process for our online customers?” is action-oriented.

### Answer

True

### Question

On a customer service questionnaire, a data analyst asks, “If you could contact our customer service department via chat, how much valuable time would that save you?” Why is this question unfair?

### Answer

It makes assumptions
<file_sep># Week 4 Quiz

### Question

Fill in the blank: A data analytics team is working on a project to measure the success of a company’s new financial strategy. The vice president of finance is most likely to be the **\_**.

### Answer

primary stakeholder

### Question

At an online marketplace, the **\_** includes anyone in an organization who interacts with current or potential shoppers.

### Answer

customer-facing team

### Question

There are four key questions data analysts ask themselves: Who is my audience? What do they already know? What do they need to know? And how can I communicate effectively with them? These questions enable data analysts to identify the person in charge of managing the data.

### Answer

False

### Question

You receive an angry email from a colleague on the marketing team. The marketing colleague believes you have taken credit for their work. You do not believe this is true. Select the best course of action.

### Answer

Reply to the email, asking if they can schedule a time to talk about this in person in order to allow both of you to share your perspectives.

### Question

Data analysts focus on statistical significance to make sure they have enough data so that a few unusual responses don’t skew results.

### Answer

False

### Question

A data analyst has been invited to a meeting. They review the agenda and notice that their data analysis project is one of the topics that will be discussed. How can they prepare for an effective meeting? Select all that apply.

### Answer

    Bring materials for taking notes.
    Think about what project updates they should share.
    Plan to arrive on time.

### Question

Which of the following steps are key to leading a professional online meeting? Select all that apply.

### Answer

    Making sure your technology is working properly before starting the meeting
    Sitting in a quiet area that’s free of distractions

### Question

Your data analytics team has been working on a project for a few weeks. You’re almost done, when your supervisor suddenly changes the business task. Everyone has to start all over again. You announce to the team that you’re going to say something to the supervisor about how unreasonable this is. What’s the best next step?

### Answer

Take a few minutes to calm down, then ask your colleagues to share their perspectives so you can work together to determine the best next step.
<file_sep># Final Quiz

### Question

Scenario 1, questions 1-5

You’ve just started a job as a data analyst at a small software company that provides data analytics and business intelligence solutions. Your supervisor asks you to kick off a project with a new client, Athena’s Story, a feminist bookstore. They have four existing locations, and the fifth shop has just opened in your community.

Athena’s Story wants to produce a campaign to generate excitement for an upcoming celebration and introduce the bookstore to the community. They share some data with your team to help make the event as successful as possible.

Your task is to review the assignment and the available data, then present your approach to your supervisor. Click the link below to access the email from your supervisor:
Then, review the email, and the Customer Survey and Historical Sales datasets.

After reading the email, you notice that the acronym WHM appears in multiple places. You look it up online, and the most common result is web host manager. That doesn’t seem right to you, as it doesn’t fit the context of a feminist bookstore. You email your supervisor to ask. When writing your email, what do you do to ensure it sounds professional? Select all that apply.

### Answer

    Use a polite greeting and closing.
    Read your email aloud before sending to catch any typos or grammatical errors and to ensure the communication is clear.
    Respect your supervisor’s time by writing an email that’s short and to the point.

### Question

Scenario 1 continued

Now that you know WHM stands for Women’s History Month, you review the Customer Survey dataset which contains both qualitative and quantitative data.

The data in column F (Survey Q6: What types of books would you like to see more of at Athena's Story?) is quantitative.

### Answer

False

### Question

Scenario 1 continued

Next, you review the customer feedback in column F of the Customer Survey dataset.
The attribute of column F is, “Survey Q6: What types of books would you like to see more of at Athena's Story?” In order to verify that children’s literature and feminist zines are among the most popular genres, you create a visualization. This will help you clearly identify which genres are most likely to sell well during the Women’s History Month campaign.

Your visualization looks like this:

![Image](./1.png)

The chart you create demonstrates the percentages of each book genre that make up the whole. It’s called an area chart.

### Answer

False

### Question

Now that you’ve confirmed that children’s literature and feminist zines are among the most requested book genres, you review the Historical Sales dataset.
You’re pleased to see that the dataset contains data that’s specific to children’s literature and feminist zines. This will provide you with the information you need to make data-inspired decisions. In addition, the children’s literature and feminist zines metrics will help you organize and analyze the data about each genre in order to determine if they’re likely to be profitable.

Next, you calculate the total sales over 52 weeks for feminist zines. What is the correct syntax?

### Answer

=SUM(E2:E53)

### Question

Scenario 1 continued

After familiarizing yourself with the project and available data, you present your approach to your supervisor. You provide a scope of work, which includes important details, a schedule, and information on how you plan to prepare and validate the data. You also share some of your initial results and the pie chart you created.

In addition, you identify the problem type, or domain, for the data analysis project. You decide that the historical sales data can be used to provide insights into the types of books that will sell best during Women’s History Month this coming year. This will also enable you to determine if Athena’s Story should begin selling more children’s literature and feminist zines.

Using historical data to make informed decisions about how things may be in the future is an example of identifying themes.

### Answer

False

### Question

Scenario 2, questions 6-10

You’ve completed this program and are now interviewing for your first junior data analyst position. You’re hoping to be hired by an event planning company, Patel Events Plus. Access the job description below:

So far, you’ve successfully completed the first round of interviews with the human resources manager and director of data and strategy. Now, the vice president of data and strategy wants to learn more about your approach to managing projects and clients. Access the email you receive from the human resources director below:

You arrive Thursday at 1:45 PM for your 2 PM interview. Soon, you’re taken into the office of <NAME>, vice president of data and strategy. After welcoming you, she begins the behavioral interview.

First, she hands you a copy of Patel Events Plus’s organizational chart. Access the chart below:

As you’ve learned in this course, stakeholders are people who invest time, interest, and resources into the projects you’ll be working on as a data analyst. Let’s say you’re working on a project involving data and strategy. Based on what you find in the organizational chart, if you need information from the primary stakeholder, who can you ask?

### Answer

Vice president, data and strategy

### Question

Scenario 2 continued

Next, the vice president wants to understand your knowledge about asking effective questions. Consider and respond to the following question. Select all that apply.

Let’s say we just completed a big event for a client and wanted to find out if they were satisfied with their experience. Provide some examples of measurable questions that you could include in the customer feedback survey.

### Answer

    Would you recommend Patel Events Plus to a colleague or friend? Yes or no?
    On a scale from 1 to 5, with 1 being not at all likely and 5 being very likely, how likely are you to recommend Patel Events Plus?

### Question

Scenario 2 continued

Now, the vice president presents a situation having to do with resolving challenges and meeting stakeholder expectations. Consider and respond to the following question.

You’re working on a rush project, and you discover your dataset is not clean. Even though it has numerous nulls, redundant data, and other issues, the primary stakeholder insists that you move ahead and use it anyway. The project timeline is so tight that there simply isn’t enough time for cleaning. How would you handle that situation?

### Answer

Communicate the situation to your supervisor and ask for advice on how to handle the situation with the stakeholder.

### Question

Scenario 2 continued

Your next interview question deals with sharing information with stakeholders. Consider and respond to the following question. Select all that apply.

Let’s say you’ve designed a dashboard to give stakeholders easy, automatic access to data about an upcoming event. Describe the benefits of using a dashboard.

### Answer

    Dashboards offer live monitoring of incoming data.
    Dashboards enable stakeholders to interact with the data.

### Question

Scenario 2 continued

Your final behavioral interview question involves using metrics to answer business questions. Your interviewer hands you a copy of the Patel Events dataset.
Then, she asks: Recently, Patel Events Plus purchased a new venue for our events. If we asked you to compare the purchase price (cost) and net profit, what would you be calculating?

### Answer

Return on investment
<file_sep># Quiz

### Que 1

True or False: Google Cloud Load Balancing allows you to balance HTTP-based traffic across multiple Compute Engine regions.

### Answer

True

### Que 2

Which statement is true about Google VPC networks and subnets?

### Answer

Networks are global; subnets are regional

### Que 3

An application running in a Compute Engine virtual machine needs high-performance scratch space. Which type of storage meets this need?

### Answer

Local SSD

### Que 4

Choose an application that would be suitable for running in a Preemptible VM.

### Answer

A batch job that can be checkpointed and restarted

### Que 5

How do Compute Engine customers choose between big VMs and many VMs?

### Answer

Use big VMs for in-memory databases and CPU-intensive analytics; use many VMs for fault tolerance and elasticity

### Que 6

How do VPC routers and firewalls work?

### Answer

They are managed by Google as a built-in feature.

### Que 7

A GCP customer wants to load-balance traffic among the back-end VMs that form part of a multi-tier application. Which load-balancing option should this customer choose?

### Answer

The regional internal load balancer

### Que 8

For which of these interconnect options is a Service Level Agreement available?

### Answer

Dedicated Interconnect
<file_sep># Course Quiz

Scenario 1, question 1-5

You’ve just started a new job as a data analyst. You’re working for a midsized pharmacy chain with 38 stores in the American Southwest. Your supervisor shares a new data analysis project with you.

She explains that the pharmacy is considering discontinuing a bubble bath product called Splashtastic. Your supervisor wants you to analyze sales data and determine what percentage of each store’s total daily sales come from that product. Then, you’ll present your findings to leadership.

You know that it's important to follow each step of the data analysis process: ask, prepare, process, analyze, share, and act. So, you begin by defining the problem and making sure you fully understand stakeholder expectations.

One of the questions you ask is where to find the dataset you’ll be working with. Your supervisor explains that the company database has all the information you need.

Next, you continue to the prepare step. You access the database and write a query to retrieve data about Splashtastic. You notice that there are only 38 rows of data, representing the company’s 38 stores. In addition, your dataset contains five columns: Store Number, Average Daily Customers, Average Daily Splashtastic Sales (Units), Average Daily Splashtastic Sales (Dollars), and Average Total Daily Sales (All Products).

### Question 1

You know that spreadsheets work well for processing and analyzing a small dataset, like the one you’re using. To get the data from the database into a spreadsheet, what should you do?

### Answer

Download the data as a .CSV file, then import it into a spreadsheet.

### Question 2

You’ve downloaded the data from your company database and imported it into a spreadsheet. To use the dataset for this scenario, click the link below and select “Use Template.”
Now, it’s time to process the data. As you know, this step involves finding and eliminating errors and inaccuracies that can get in the way of your results. While cleaning the data, you notice that information about Splashtastic is missing in row 16. The best course of action is to delete row 16 from your dataset so the missing data doesn’t get in the way of your results.

### Answer

False

### Question 3

Once you’ve found the missing information, you analyze your dataset.

During analysis, you create a new column F. At the top of the column, you add: Average Percentage of Total Sales - Splashtastic. What is this column label called?

### Answer

An attribute

### Question 4

Next, you determine the average store sales of Splashtastic over the past 12 months at all stores, The range that contains these sales is E2:E39. To do this, you use a function. Fill in the blank to complete the function correctly: =**\_** (E2:E39).

### Answer

AVERAGE

### Question 5

You’ve reached the share phase of the data analysis process. It involves which of the following? Select all that apply.

### Answer

    Create a data visualization to highlight the Splashtastic sales insights you've discovered.
    Prepare a slideshow about Splashtastic’s sales and practice your presentation.
    Present your findings about Splashtastic to stakeholders.

Scenario 2, questions 6-10

You’ve been working for the nonprofit National Dental Society (NDS) as a junior data analyst for about two months. The mission of the NDS is to help its members advance the oral health of their patients. NDS members include dentists, hygienists, and dental office support staff.

The NDS is passionate about patient health. Part of this involves automatically scheduling follow-up appointments after crown replacement, emergency dental surgery, and extraction procedures. NDS believes the follow-up is an important step to ensure patient recovery and minimize infection.

Unfortunately, many patients don’t show up for these appointments, so the NDS wants to create a campaign to help its members learn how to encourage their patients to take follow-up appointments seriously. If successful, this will help the NDS achieve its mission of advancing the oral health of all patients.

Your supervisor has just sent you an email saying that you’re doing very well on the team, and he wants to give you some additional responsibility. He describes the issue of many missed follow-up appointments. You are tasked with analyzing data about this problem and presenting your findings using data visualizations.

An NDS member with three dental offices in Colorado offers to share its data on missed appointments. So, your supervisor uses a database query to access the dataset from the dental group. The query instructs the database to retrieve all patient information from the member’s three dental offices, located in zip code 81137.

### Question 6

The table is dental_data_table, and the column name is zip_code. You write the following query, but get an error. What statement will correct the problem?

![Image 1](Images/1.jpg)

### Answer

WHERE zip_code = 81137

### Question 7

The dataset your supervisor retrieved and imported into a spreadsheet includes a list of patients, their demographic information, dental procedure types, and whether they attended their follow-up appointment. To use the dataset for this scenario, click the link below and select “Use Template.”
The patient demographic information includes data such as age and gender. As you’re learning, it’s your responsibility as a data analyst to make sure your analysis is fair. The fact that the dataset includes people who all live in the same zip code might get in the way of fairness.

### Answer

True

### Question 8

As you’re reviewing the dataset, you notice that there are a disproportionate number of senior citizens. So, you investigate further and find out that this zip code represents a rural community in Colorado with about 800 residents. In addition, there’s a large assisted-living facility in the area. Nearly 300 of the residents in the 81137 zip code live in the facility.

You recognize that’s a sizable number, so you want to find out if age has an effect on a patient’s likelihood to attend a follow-up dental appointment. You analyze the data, and your analysis reveals that older people tend to miss follow-ups more than younger people.

So, you do some research online and discover that people over the age 60 are 50% more likely to miss dentist appointments. Sometimes this is because they’re on a fixed income. Also, many senior citizens lack transportation to get to and from appointments.

With this new knowledge, you write an email to your supervisor expressing your concerns about the dataset. He agrees with your concerns, but he’s also impressed with what you’ve learned and thinks your findings could be very important to the project. He asks you to change the business task. Now, the NDS campaign will be about educating dental offices on the challenges faced by senior citizens and finding ways to help them access quality dental care.

Fill in the blank: Changing the business task involves defining a new **\_**.

### Answer

question or problem to be solved

### Question 9

You continue with your analysis. In the end, your findings support what you discovered during your online research: As people get older, they’re less likely to attend follow-up dental visits.

But you’re not done yet. You know that data should be combined with human insights in order to lead to true data-driven decision-making. So, your next step is to share this information with people who are familiar with the problem. They’ll help verify the results of your data analysis.

Fill in the blank: The people who are familiar with a problem and help verify the results of data analysis are **\_**.

### Answer

subject-matter experts

### Question 10

The subject-matter experts are impressed by your analysis. The team agrees to move to the next step: data visualization. You know it’s important that stakeholders at NDS can quickly and easily understand that older people are less likely to attend important follow-up dental appointments. This will help them create an effective campaign for members.

It’s time to create your presentation to stakeholders. It will include a data visualization that depicts the relationship between age and follow-up dental appointment attendance rates. For this, a doughnut chart will be most effective.

### Answer

False
<file_sep>import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
pwm = GPIO.PWM(12, 50)
pwm.start(0)
while True:
    for i in range(100):
        pwm.ChangeDutyCycle(i)
        time.sleep(0.01)
    for i in range(100, 0, -1):
        pwm.ChangeDutyCycle(i)
        time.sleep(0.01)
<file_sep>## Google-IT-Automation-with-Python Specialization


### This module contains the code snippets and files that will help you in completing the courses.
<file_sep># Week 3 Quiz

### Question

In which stage of the data life cycle does a business decide what kind of data it needs, how the data will be managed, and who will be responsible for it?

### Answer

Plan

### Question

The destroy stage of the data life cycle might involve which of the following actions? Select all that apply.

### Answer

    Shredding paper files
    Using data-erasure software

### Question

A data analyst uses a spreadsheet function to aggregate data. Then, they add a pivot table to show totals from least to greatest. This would happen during which stage of the data life cycle?

### Answer

Analyze

### Question

The data life cycle deals with the stages that data goes through; data analysis involves following a process to analyze data.

### Answer

True

### Question

A company takes insights provided by its data analytics team, validates them, and finalizes a strategy. They then implement a plan to solve the original business problem. This describes the share step of the data analysis process.

### Answer

False

### Question

Fill in the blank: A function is a predefined operation, whereas a formula is **\_**.

### Answer

a set of instructions used to perform a specified calculation.

### Question

Data analysts use queries to request, retrieve, and update information within a database.

### Answer

True

### Question

Structured query language (SQL) enables data analysts to communicate with a database.

### Answer

True

### Question

Fill in the blank: A business decides what kind of data it needs, how the data will be managed, and who will be responsible for it during the **\_** stage of the data life cycle.

### Answer

Plan

### Question

A data analyst is working at a small tech startup. They’ve just completed an analysis project, which involved private company information about a new product launch. In order to keep the information safe, the analyst uses secure data-erasure software for the digital files and a shredder for the paper files. Which stage of the data life cycle does this describe?

### Answer

Destroy

### Question

Fill in the blank: The data life cycle has six stages, whereas data analysis has six **\_**.

### Answer

Process steps

### Question

A company takes insights provided by its data analytics team, validates them, and finalizes a strategy. They then implement a plan to solve the original business problem. This describes which step of the data analysis process?

### Answer

Act

### Question

Fill in the blank: A formula is a set of instructions used to perform a specified calculation; whereas a function is **\_**.

### Answer

A predefined operation

### Question

Fill in the blank: A query is used to **\_** information from a database. Select all that apply.

### Answer

    Retrieve
    Request
    Update
<file_sep># Quiz

### Question 1

True or False: The number of examples specified in the model config file (as num_examples, under eval_config) must exactly match the number of sample images in the images/test folder.

### Answer

True. It is necessary.

### Question 2

In our project, which software library is responsible for detecting/recognizing the Region of Interest or ROI, which in our case is segments of an image that contain text, and requires training to be able to do so?

### Answer

Tensorflow

### Question 3

True or false: Tensorflow requires us to convert annotation data from XML, CSV or other formats into TFRecord format .

### Answer

True

### Question 4

Which of the following needs to be changed to match our setup within the config file?

### Answer

        path to labelmap
        num_classes
        path to checkpoint

### Question 5

In order to capture a webcam feed, what parameter do we pass to cv2.VideoCapture()?

### Answer

0+cv2.CAP_DSHOW

### Question 6

What command begins the Tensorflow detection session?

### Answer

sess.run()

### Question 7

We can extract the box coordinates to extract our ROI using the vis_util.return_coordinates(). Before doing this, how do we check that the detected object is the one we want?

### Answer

Check category_index[i]['name]
<file_sep>### If you do not have access to a real Arduino, you can visit tinkedcad.com to simulate an Arduino

### Then open Arduino IDE, load the required example, and paste the code from Arduino IDE to your tinkercad circuit or create your own code and paste it onto the code section at tinkedcad.com in your circuit.
<file_sep># This is the file that was created on Github and then imported via a pull request
def hello():
    print('Greetings')
<file_sep>## Assignment

![Memory Usage](Capture1.png)

![Arduino with led](Capture2.png)
<file_sep># Quiz

### Que 1

Which of the following does not allow you to interact with GCP?

### Answer

Cloud Explorer

### Que 2

What is the difference between GCP Console and Cloud Shell?

### Answer

Cloud Shell is a command-line tool, while GCP Console is a graphical user interface
<file_sep>## Quiz

### Question 1

In a communication over the Internet, how is the “port” number used?

### Answer

to identify the application protocol being used

### Question 2

The Domain Name Service is:

### Answer

a service to map domain names to IP addresses

### Question 3

Which of the following is NOT an argument to the Ethernet.begin() function?

### Answer

Local processor

### Question 4

DHCP is:

### Answer

a protocol to assign IP addresses to network nodes

### Question 5

What is NOT a type of encryption used in WiFi today?

### Answer

WPC

### Question 6

True or False: The SSID of a WiFi network is the name of the network.

### Answer

True

### Question 7

True or False: An Ethernet client does not send data to an Ethernet server.

### Answer

False

### Question 8

True or False: A MAC address is unique for each network adapter.

### Answer

True
<file_sep>## Python Project Pillow, Tesseract and OpenCV

### There is no week 3 folder because there is no quiz or assignment in week 2<file_sep>## Using Python to interact with the Operating System

### In this repo, you will find only the answers for the Qwiklabs Graded External Tool. There are no answers for practice quizzes.<file_sep>## Assignment

### Code

```
void setup()
{
  pinMode(13, OUTPUT);
  pinMode(2, INPUT);
  pinMode(5, INPUT);
}

void loop()
{
  if (digitalRead(2) == HIGH || digitalRead(5) == HIGH)
  	digitalWrite(13, HIGH);
  else
    digitalWrite(13, LOW);
}
```

![Circuit](Capture.png)
<file_sep>## Data Structures and Algorithms Specialization offered by University of California San Diego & National Research University Higher School of Economics

### This module contains the solutions from the courses that I have completed in the above mentioned Specialization.<file_sep>## Quiz

### Question 1

An EEPROM is:

### Answer

non-volatile

### Question 2

A mask is:

### Answer

a sequence of bits used to identify bits of interest

### Question 3

Assume that you have a byte but you are interested in only the 2 least significant bits of the byte. Which hexadecimal number represents the mask that you would use to help you?

### Answer

0x03

### Question 4

How many wires are used for communication in the I2C protocol?

### Answer

2

### Question 5

Which role describes a node that places data on the bus?

### Answer

Transmitter

### Question 6

When is an Acknowledge bit sent?

### Answer

after each byte is sent

### Question 7

True or False: The Wire.write() function buffers data before sending it.

### Answer

True

### Question 8

True or False: During normal operation, the SDA line should not change while the SCL line is high.

### Answer

True
<file_sep>#include <iostream>
#include <vector>
using namespace std;

int fibonacci_fast(int n) {
    vector<int> f;
    f.push_back(0);
    f.push_back(1);
    for (int i = 2; i <= 60; i++){
        f.push_back((f[i-1] + f[i-2]) % 10);
    }
    int temp = n % 60;
    return f[temp];
}

int main() {
    int n;
    cin >> n;
    if (n <= 1){
        cout << n;
    }
    else
    {
        cout << fibonacci_fast(n) << '\n';
    }
    return 0;
}
<file_sep># Quiz

### Que 1

What is the foundational process at the base of Google's Site Reliability Engineering (SRE) ?

### Answer

Monitoring

### Que 2

What is the purpose of the Stackdriver Trace service?

### Answer

Reporting on latency as part of managing performance.

### Que 3

Stackdriver integrates several technologies, including monitoring, logging, error reporting, and debugging that are commonly implemented in other environments as separate solutions using separate products. What are key benefits of integration of these services?

### Answer

Reduces overhead, reduces noise, streamlines use, and fixes problems faster
<file_sep>## Quiz

### Question 1

What is the function of the linking process after compilation?

### Answer

It merges the libraries with the application code into a single executable

### Question 2

What is the role of avrdude?

### Answer

It writes the executable into the memory of the Arduino

### Question 3

Why are classes (in C++) useful?

### Answer

They improve the organization and understandability of the code

### Question 4

What is one way that a sketch can invoke a function contained inside a class?

### Answer

The name of the class can be concatenated with the name of the function, with a period in between.

### Question 5

Which of the following statements is true?

### Answer

The setup() function is executed once and the loop() function is executed iteratively, as long as the Arduino is powered on.

### Question 6

True or False: An analog pin can accept analog inputs and drive analog outputs.

### Answer

False

### Question 7

If a sketch running on an Arduino UNO executes the following statements, what voltage would be expected on pin 1 afterwards?

```
pinMode(1, OUTPUT);
digitalWrite(1, HIGH);
```

### Answer

5

### Question 8

True or False: The delay() function causes program execution to pause for a number of milliseconds.

### Answer

True
<file_sep># This is the file that was created in the linux instance
def git_operation():
    print("I am adding example.py file to the remote repository.")


git_operation()
<file_sep>#include <iostream>
#include <cmath>
using namespace std;

int change(int amount)
{
    int denominations_10 = floor(amount / 10);
    int denominations_5 = floor((amount - denominations_10 * 10) / 5);
    int denominations_1 = amount - (denominations_10 * 10 + denominations_5 * 5);
    return denominations_1 + denominations_5 + denominations_10;
}

int main()
{
    int amount;
    cin >> amount;
    cout << change(amount);
}<file_sep># Week 4 Quiz
## Questions with same question number are the ones that vary from one quiz to another!!

### Question 1
What is produced at the end of this snippet of R code?
```
set.seed(1)
rpois(5, 2)
```
### Answer
A vector with the numbers 1, 1, 2, 4, 1

### Question 2
What R function can be used to generate standard Normal random variables?
### Answer
rnorm

### Question 3
When simulating data, why is using the set.seed() function important? Select all that apply.
### Answer
It ensures that the sequence of random numbers starts in a specific place and is therefore reproducible.

### Question 4
Which function can be used to evaluate the inverse cumulative distribution function for the Poisson distribution?
### Answer
qpois

### Question 5
What does the following code do?
```
set.seed(10)
x <- rep(0:1, each = 5)
e <- rnorm(10, 0, 20)
y <- 0.5 + 2 * x + e
```
### Answer
Generate data from a Normal linear model

### Question 5
What does the following code do?
```
set.seed(10)
x <- rbinom(10, 10, 0.5)
e <- rnorm(10, 0, 20)
y <- 0.5 + 2 * x + e
```
### Answer
Generate data from a Normal linear model

### Question 6
What R function can be used to generate Binomial random variables?
### Answer
rbinom

### Question 7
What aspect of the R runtime does the profiler keep track of when an R expression is evaluated?
### Answer
the function call stack

### Question 8
Consider the following R code
```
library(datasets)
Rprof()
fit <- lm(y ~ x1 + x2)
Rprof(NULL)
```
(Assume that y, x1, and x2 are present in the workspace.) Without running the code, what percentage of the run time is spent in the 'lm' function, based on the 'by.total' method of normalization shown in 'summaryRprof()'?
### Answer
100%
### Question 9
When using 'system.time()', what is the user time?
### Answer
It is the time spent by the CPU evaluating an expression

### Question 10
f a computer has more than one available processor and R is able to take advantage of that, then which of the following is true when using 'system.time()'?
### Answer
Elapsed time may be smaller than user time<file_sep>#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

long long fibonacci_sum_last_digit(long long n) {
    vector<int> f;
    f.push_back(0);
    f.push_back(1);
    for (int i = 2; i <= 60; i++){
        f.push_back((f[i-1] + f[i-2]) % 10);
    }
    long long rem = n % 60;
    long long quotient = (n - rem) / 60;
    return (accumulate(f.begin(), f.end(), 0) * quotient + accumulate(f.begin(), f.begin() + rem + 1, 0)) % 10;
}

int main() {
    long long n;
    cin >> n;
    if (n <= 1)
        cout << n;
    else
        cout << fibonacci_sum_last_digit(n) << '\n';
    return 0;
}
<file_sep># Week 5 Quiz

### Question

An online gardening magazine wants to understand why its subscriber numbers have been increasing. A data analyst discovers that significantly more people subscribe when the magazine has its annual 50%-off sale. This is an example of what?

### Answer

Analyzing customer buying behaviors

### Question

A doctor’s office has discovered that patients are waiting 20 minutes longer for their appointments than in past years. A data analyst could help solve this problem by analyzing how many doctors and nurses are on staff at a given time compared to the number of patients with appointments.

### Answer

True

### Question

Describe the difference between a question and a problem in data analytics.

### Answer

A question is designed to discover information, whereas a problem is an obstacle or complication that needs to be solved.

### Question

Fill in the blank: A business task is described as the problem or **\_** a data analyst answers for a business.

### Answer

question

### Question

What is the process of using facts to guide business strategy?

### Answer

Data-driven decision-making

### Question

Data analysts ensure their analysis is fair for what reason?

### Answer

Fairness helps them avoid biased conclusions.

### Question

Fill in the blank: Fairness is achieved when data analysis doesn't create or **\_** bias.

### Answer

reinforce

### Question

A magazine wants to understand why its subscribers have been increasing. A data analyst could help answer that question with a report that predicts the result of a half-price sale on future subscription rates.

### Answer

False

### Question

Fill in the blank: A problem is an obstacle to be solved, an issue is a topic to investigate, and a **\_** is designed to discover information.

### Answer

Question

### Question

A large hotel chain sees about 500 customers per week. A data analyst working there is gathering data through customer satisfaction surveys. They are anxious to begin analysis, so they start analyzing the data as soon as they receive 50 survey responses. This is an example of what? Select all that apply.

### Answer

    Failing to have a large enough sample size
    Failing to include diverse perspectives in data collection
<file_sep># Week 2 Quiz

### Question

In data analytics, a pattern is defined as a process or set of rules to be followed for a specific task.

### Answer

False

### Question

In data analytics, quantitative data measures qualities and characteristics.

### Answer

False

### Question

In data analytics, reports use data that doesn’t change once it’s been recorded. Which of the following terms describes this type of data?

### Answer

Static

### Question

A pivot table is a data-summarization tool used in data processing. Which of the following tasks can pivot tables perform? Select all that apply.

### Answer

    Calculate totals from data
    Group data
    Reorganize data

### Question

What is an example of using a metric? Select all that apply.

### Answer

    Using annual profit targets to set and evaluate goals
    Using key performance indicators, such as click-through rates, to measure revenue

### Question

Which of the following options describes a metric goal? Select all that apply.

### Answer

    Evaluated using metrics
    Measurable

### Question

Fill in the blank: Return on investment compares the cost of an investment to the **\_** of that investment.

### Answer

net profit

### Question

A data analyst is using data from a short time period to solve a problem related to someone’s day-to-day decisions. They are most likely working with small data.

### Answer

True
<file_sep># temp-linux
Hello this is the README file for this repository that was created on Github platform and then imported
<file_sep># Quiz

### Question 1
How do we display an image in Python using OpenCV?
### Answer
    imshow()

### Question 2
How is the width and length of an image retrieved with Python OpenCV using indexing: org_height, org_width =  _____ ?
### Answer
    image.shape[0:2]

### Question 3
How does increasing the kernel size effect the blur?
### Answer
    increases the blur

### Question 4
What generally happens to a given pixel's neighboring pixels when an image is sharpened?
### Answer
    Different from the given pixel

### Question 5
What python library is used to check for the existence of a directory?
### Answer
    os
<file_sep># Quiz

### Que 1

Which of the following is not a GCP load balancing service?

### Answer

Hardware-defined load balancing

### Que 2

Which three GCP load balancing services support IPv6 clients?

### Answer

    HTTP(S) load balancing
    TCP proxy load balancing
    SSL proxy load balancing

### Que 3

Which of the following are applicable autoscaling policies for managed instance groups?

### Answer

    Queue-based workload
    Monitoring metrics
    Load balancing capacity
    CPU utilization
<file_sep>def knapsack(dict, capacity):
    amount = 0
    temp = []
    for i, j in dict:
        temp_value, temp_weight = j
        if temp_weight <= capacity != 0 and i not in temp:
            amount += temp_value
            capacity -= temp_weight

        elif temp_weight > capacity != 0 and i not in temp:
            amount += temp_value / (temp_weight / capacity)
        else:
            pass
        temp.append(i)
    return format(amount, '.4f')


if __name__ == '__main__':
    items, capacity = map(int, input().split())
    dict = {}
    for i in range(items):
        value, weight = map(int, input().split())
        dict[int(value/weight)] = (value, weight)
    dict = sorted(dict.items(), reverse=True)
    print(knapsack(dict, capacity))
<file_sep>def pisano_period(m):
    previous, current = 0, 1
    for i in range(0, m * m):
        previous, current = current, (previous + current) % m
        if previous == 0 and current == 1:
            return i + 1


def fibonacci_huge(n, m):
    pp_index = pisano_period(m)
    n = n % pp_index
    previous, current = 0, 1
    if n <= 1:
        return n
    for i in range(n - 1):
        previous, current = current, previous + current
    return current % m


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(fibonacci_huge(n, m))
<file_sep># Quiz

### Que 1

Choose fundamental characteristics of cloud computing. Mark all that are correct (4 correct responses).

### Answer

    Customers can scale their resource use up and down
    Resources are available from anywhere over the network
    Computing resources available on-demand and self-service
    Customers pay only for what they use or reserve

### Que 2

Choose a fundamental characteristic of devices in a virtualized data center.

### Answer

They are manageable separately from the underlying hardware.

### Que 3

What type of cloud computing service lets you bind your application code to libraries that give access to the infrastructure your application needs?

### Answer

Platform as a Service

### Que 4

What type of cloud computing service provides raw compute, storage, and network, organized in ways that are familiar from physical data centers?

### Answer

Infrastructure as a Service

### Que 5

Which statement is true about the zones within a region?

### Answer

The zones within a region have fast network connectivity among them.

### Que 6

What kind of customer benefits most from billing by the second for cloud resources such as virtual machines?

### Answer

Customers who create and run many virtual machines
<file_sep>import itertools


def prizes(lst, num):
    final = []
    length = 0
    for i in range(1, num):
        temp = list(itertools.permutations(lst, i))
        temp2 = [i for i in temp if sum(i) == num]
        final.append(temp2)
        if len(temp2) > length:
            length = len(temp2)
        final = [i for i in final if len(i) == length]

    print(len(final[0][0]))
    return ' '.join([str(i) for i in final[0][0]])


if __name__ == "__main__":
    num = int(input())
    nums = [int(i) for i in range(1, num + 1)]
    print(prizes(nums, num))
<file_sep># Quiz

### Que 1

Which statement is true of Virtual Machine Instances in Compute Engine?

### Answer

In Compute Engine, a VM is a networked service that simulates the features of a computer.

### Que 2

What are sustained use discounts?

### Answer

Automatic discounts that you get for running specific Compute Engine resources for a significant portion of the billing month

### Que 3

Which statement is true of persistent disks?

### Answer

Persistent disks are encrypted by default.
<file_sep># Quiz

### Que 1

What abstraction is primarily used to administer user access in Cloud IAM ?

### Answer

Roles, an abstraction of job roles.

### Que 2

Question 2
Which of the following is not a type of IAM role?

### Answer

Advanced

### Que 3

Which of the following is not a type of IAM member?

### Answer

Organization Account
<file_sep>## Quiz

### Question 1

What is a fair definition of an API?

### Answer

A protocol for communicating between programs

### Question 2

What is a good reason to use an SDK rather than directly using an API?

### Answer

An SDK is usually easier to use than an API

### Question 3

What is Pip?

### Answer

A tool to install Python packages

### Question 4

In the Twython library, what function sends a tweet?

### Answer

update_status()

### Question 5

In the Twython library, what function is used to detect tweets in a stream that contain a given string?

### Answer

stream.statuses.filter()

### Question 6

What is the name of the callback function that is invoked when a tweet that contains a selected string is found in a stream?

### Answer

on_success()

### Question 7

The TwythonStreamer class defines the callback function which is invoked when a tweet containing a given string is found in a stream.

### Answer

True
<file_sep>#include <EEPROM.h>
void setup()
{
    Serial.begin(9600);
}
void loop()
{
    String buffer = "";
    buffer = Serial.readString();
    int address, data;
    if (buffer.startsWith("read"))
    {
        address = buffer.substring(buffer.indexOf(' ') + 1).toInt();
        Serial.print("Data:");
        Serial.print(address);
        Serial.println();
        Serial.println(EEPROM.read(address));
    }
    else if (buffer.startsWith("write"))
    {
        address = buffer.substring(6, 7).toInt();
        data = buffer.substring(8).toInt();
        Serial.print("Address:");
        Serial.print(data);
        Serial.println();
        Serial.print(address);
        Serial.println();
        EEPROM.write(address, data);
    }
}<file_sep>## R Programming by John Hopkins University

### This course contains the quiz and programming solutions to the coursera course R programming offered by John Hopkins University.

### While running programming code files, make sure that the data or the csv files are in the same directory you are working in. <file_sep># Week 3 Quiz

### Question

In spreadsheets, formulas and functions end with an equal sign (=).

### Answer

False

### Question

Fill in the blank: The labels that describe the type of data contained in each column of a spreadsheet are called **\_**.

### Answer

attributes

### Question

To determine an organization’s annual budget, a data analyst might use a slideshow.

### Answer

False

### Question

Which of the following statements accurately describe formulas and functions? Select all that apply.

### Answer

    Functions are preset commands that perform calculations.
    Formulas are instructions that perform specific calculations.
    Formulas and functions assist data analysts in calculations, both simple and complex.

### Question

In the function =MAX(G3:G13), what does G3:G13 represent?

### Answer

The range

### Question

What is the correct spreadsheet formula for multiplying cell D5 times cell D7?

### Answer

=D5\*D7

### Question

Fill in the blank: By negatively influencing data collection, \_\_\_\_ can have a detrimental effect on analysis.

### Answer

bias

### Question

Fill in the blank: A data analyst considers which organization created, collected, or funded a dataset in order to understand its **\_**.

### Answer

context
<file_sep># Quiz

### Question 1
What of these libraries are associated with web scraping?
### Answer
    BeautifulSoup
    requests

### Question 2
What are valid methods for getting an div element through BeautifulSoup?
### Answer
    soup.find_all('div')
    soup['div']
    soup.find('div')

### Question 3
How can you search for elements of any type that has a given class?
### Answer
    Through soup.find_all(None, {'class':'given_class'})

### Question 4
What are some of the key functionalities of the browser developer tools?
### Answer
    A JavaScript console that allows you to run code on the web page

    A interactive inspection of the web page soure code
    
    An analyzer for all the traffic that happens when you interact with a web page

### Question 5
Why would you use a selector on BeautifulSoup?
### Answer
    Because you don't have to do a lot of source code exploration in order to use it
    
    Because you can have it easily through the inspect element functionality of the DevTools

    Because it allows you to navigate on complex patterns

### Question 6
What of those are valid ways of performing a POST request?
### Answer
    r = req.post(LINK)
     
    params = json.dumps({'username': 'admin'})
    headers = {'Content-Type': 'application/json'}
    r = req.post(LINK, params, headers=headers)
    
### Question 7
Why would you use a Session object for performing GET and POST requests?
### Answer
    In order to store cookies and mantain the connection state

<file_sep># Week 2 Quiz

### Question 1
Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints its hexadecimal value. Currently, it only supports the three additive primary colors (red, green, blue), so it returns "unknown" for all other colors.
### Answer
```
def color_translator(color):
	if color == "red":
		hex_color = "#ff0000"
	elif color == "green":
		hex_color = "#00ff00"
	elif color == "blue":
		hex_color = "#0000ff"
	else:
		hex_color = "unknown"
	return hex_color

print(color_translator("blue")) # Should be #0000ff
print(color_translator("yellow")) # Should be unknown
print(color_translator("red")) # Should be #ff0000
print(color_translator("black")) # Should be unknown
print(color_translator("green")) # Should be #00ff00
print(color_translator("")) # Should be unknown
```

### Question 2
What's the value of this Python expression: "big" > "small"
### Answer
False

### Question 3
What is the elif keyword used for?
### Answer
To handle more than two comparison cases.

### Question 4
Students in a class receive their grades as Pass/Fail. Scores of 60 or more (out of 100) mean that the grade is "Pass". For lower scores, the grade is "Fail". In addition, scores above 95 (not included) are graded as "Top Score". Fill in this function so that it returns the proper grade.
### Answer
```
def exam_grade(score):
	if score>95:
		grade = "Top Score"
	elif score>=60:
		grade = "Pass"
	else:
		grade = "Fail"
	return grade

print(exam_grade(65)) # Should be Pass
print(exam_grade(55)) # Should be Fail
print(exam_grade(60)) # Should be Pass
print(exam_grade(95)) # Should be Pass
print(exam_grade(100)) # Should be Top Score
print(exam_grade(0)) # Should be Fail
```

### Question 5
What's the value of this Python expression: 11 % 5?
### Answer
1

### Question 6
Complete the body of the format_name function. This function receives the first_name and last_name parameters and then returns a properly formatted string.

Specifically:

If both the last_name and the first_name parameters are supplied, the function should return like so:
```
print(format_name("Ella", "Fitzgerald"))
Name: <NAME>
```
If only one name parameter is supplied (either the first name or the last name) , the function should return like so:
```
print(format_name("Adele", ""))
Name: Adele
```
or
```
print(format_name("", "Einstein"))
Name: Einstein
```
Finally, if both names are blank, the function should return the empty string:
```
print(format_name("", ""))
```
### Answer
```
def format_name(first_name, last_name):
	if first_name!="" and last_name!="":
		string="Name: "+last_name+", "+first_name
	elif first_name=="" and last_name=="":
		string=""
	elif first_name=="" or last_name=="":
		if first_name=="":
			string="Name: "+last_name 
		else:
			string="Name: "+first_name
	return string 

print(format_name("Ernest", "Hemingway"))
# Should return the string "Name: Hemingway, Ernest"

print(format_name("", "Madonna"))
# Should return the string "Name: Madonna"

print(format_name("Voltaire", ""))
# Should return the string "Name: Voltaire"

print(format_name("", ""))
# Should return an empty string
```

### Question 7
The longest_word function is used to compare 3 words. It should return the word with the most number of characters (and the first in the list when they have the same length). Fill in the blank to make this happen.
### Answer
```
def longest_word(word1, word2, word3):
	if len(word1) >= len(word2) and len(word1) >= len(word3):
		word = word1
	elif len(word2) >= len(word1) and len(word2) >= len(word3):
		word = word2
	else:
		word = word3
	return(word)

print(longest_word("chair", "couch", "table"))
print(longest_word("bed", "bath", "beyond"))
print(longest_word("laptop", "notebook", "desktop"))
```

### Question 8
What’s the output of this code?
```
def sum(x, y):
		return(x+y)
print(sum(sum(1,2), sum(3,4)))
```
### Answer
10

### Question 9
What's the value of this Python expression
`((10 >= 5*2) and (10 <= 5*2))`
### Answer
True

### Question 10
The fractional_part function divides the numerator by the denominator, and returns just the fractional part (a number between 0 and 1). Complete the body of the function so that it returns the right number. Note: Since division by 0 produces an error, if the denominator is 0, the function should return 0 instead of attempting the division.
### Answer
```
def fractional_part(numerator, denominator):
	if denominator!=0:
		x=float(numerator/denominator)
		l=[i for i in str(x).split(".")]
		y=l[0]
		num=x-int(y)
	else:
		num=0

	return num

print(fractional_part(5, 5)) # Should be 0
print(fractional_part(5, 4)) # Should be 0.25
print(fractional_part(5, 3)) # Should be 0.66...
print(fractional_part(5, 2)) # Should be 0.5
print(fractional_part(5, 0)) # Should be 0
print(fractional_part(0, 5)) # Should be 0
```<file_sep>def calc_fib(n):

    f = [0, 1]
    for i in range(2, 61):
        f.insert(i, (f[i-1] + f[i-2]) % 10)
    temp = n % 60
    return f[temp]

n = int(input())
print(calc_fib(n))
<file_sep>## This module contains the assignment and quiz answers to the course 'Applied Machine Learning in Python' provided by University of Michigan, part of Applied Data Science with Python Specialization.
<file_sep>## Quiz

### Question 1

Which of the following does NOT provide observability in a system?

### Answer

A switch connected to an Arduino input pin

### Question 2

What is meant by the expression “run control of the target”?

### Answer

The ability to stop and start the execution of the target microcontroller

### Question 3

What is NOT an advantage of using a remote debugger?

### Answer

Remote debugging requires an extra communication channel for debugging

### Question 4

What is NOT a feature of an embedded debug interface?

### Answer

Automatic test generation is commonly supported

### Question 5

Which of the following is NOT an advantage of the UART protocol?

### Answer

Higher data transfer rates are typically achieved compared to a parallel protocol

### Question 6

Which of the following statements is NOT true about the UART protocol?

### Answer

The data transmission rate is equal to the baud rate

### Question 7

Synchronization is performed in the UART protocol based on the timing of the Start bit.

### Answer

True

### Question 8

An error in bit transmission (perhaps due to noise) may not be detected, even if a parity bit is used.

### Answer

True
<file_sep>def calc_fib(m, n):

    f = [0, 1]
    for i in range(2, 61):
        f.insert(i, (f[i-1] + f[i-2]) % 10)
    rem1 = m % 60
    quotient1 = (m - rem1) / 60
    rem2 = n % 60
    quotient2 = (n - rem2) / 60
    sum1, sum2, sum3 = sum(f[rem1:]), sum(f[:rem2+1]), sum(f) * (quotient2 - (quotient1 + 1))
    return int((sum1 + sum2 +sum3) % 10)

if __name__ == '__main__':
    m, n = map(int, input().split())
    print(calc_fib(m, n))
<file_sep># Quiz

### Que 1

You’re building a RESTful microservice. Which would be a valid data format for returning data to the client?

### Answer

All of the above.

### Que 2

You’re writing a service, and you need to handle a client sending you invalid data in the request. What should you return from the service?

### Answer

A 400 error code

### Que 3

Which below would violate 12-factor app best practices?

### Answer

Store configuration information in your source repository for easy versioning.

### Que 4

You’ve re-architected a monolithic web application so state is not stored in memory on the web servers, but in a database instead. This has caused slow performance when retrieving user sessions though. What might be the best way to fix this?

### Answer

Use a caching service like Redis or Memorystore.
<file_sep># Quiz

### Que 1

Currently, you are using Firestore to store information about products, reviews, and user sessions. You'd like to speed up data access in a simple, cost-effective way. What would you recommend?

### Answer

Cache the data using Memorystore.

### Que 2

You want to analyze sales trends. To help achieve this, you want to combine data from your on-premises Oracle database with Google Analytics data and your web server logs. Where might you store the data so it is both easy to query and cost-effective?

### Answer

BigQuery

### Que 3

You are a global financial services company with users all over the world. You need a database service that can provide low latency worldwide with strong consistency. Which service might you choose?

### Answer

Spanner

### Que 4

You need to store user preferences, product information, and reviews for a website you are building. There won't be a huge amount of data. What would be a simple, cost-effective, managed solution?

### Answer

Firestore
<file_sep>#include <iostream>
using namespace std;

int pisano_period(int m) {
    int previous = 0;
    int current = 1;
    for (int i = 0; i < m * m; i++){
        previous = current;
        current = (previous + current) % m;
        if (previous == 0 && current == 1)
            return  i + 1;
    }
    return 1;
}

int fibonacci_huge(int n, int m) {
    int pp_index = pisano_period(m);
    n = n % pp_index;
    int previous = 0;
    int current = 1;
    for (int i = 0; i < n-1; i++){
        previous = current;
        current = previous + current;
    }
    return current % m;
}
    

int main(){
    int m, n;
    cin >> n, m;
    cout << fibonacci_huge(n, m);
    return 0;
}
<file_sep>## This module contains the assignment answers to the course 'Algorithmic Toolbox' provided by University of California San Diego & National Research University Higher School of Economics, part of IT Automation Specialization.

### Both the cpp and py scripts give the correct answer.
### I uploaded both because I practiced in both.
### The Dummy Scripts folder in each week contains the blank scripts provided by the course to complete for yourself.

### Only Week 1 and 2 are complete beacuse this course in ongoing.
### I'll keep updating as I go through
<file_sep># Week 4 Quiz
### Question 1
The format_address function separates out parts of the address string into new strings: house_number and street_name, and returns: "house number X on street named Y". The format of the input string is: numeric house number, followed by the street name which may contain numbers, but never by themselves, and could be several words long. For example, "123 Main Street", "1001 1st Ave", or "55 North Center Drive". Fill in the gaps to complete this function.
### Answer
```
def format_address(address_string):
    list1 = address_string.split()
    hno = list1[0]
    sno = " ".join(list1[1:])
    return f"house number {hno} on street named {sno}"


print(format_address("123 Main Street"))
# Should print: "house number 123 on street named Main Street"

print(format_address("1001 1st Ave"))
# Should print: "house number 1001 on street named 1st Ave"

print(format_address("55 North Center Drive"))
# Should print "house number 55 on street named North Center Drive"

```

### Question 2
The highlight_word function changes the given word in a sentence to its upper-case version. For example, highlight_word("Have a nice day", "nice") returns "Have a NICE day". Can you write this function in just one line?
### Answer
```
def highlight_word(sentence, word):
	return(sentence.replace(word,word.upper()))

print(highlight_word("Have a nice day", "nice"))
print(highlight_word("Shhh, don't be so loud!", "loud"))
print(highlight_word("Automating with Python is fun", "fun"))

```

### Question 3
A professor with two assistants, Jamie and Drew, wants an attendance list of the students, in the order that they arrived in the classroom. Drew was the first one to note which students arrived, and then Jamie took over. After the class, they each entered their lists into the computer and emailed them to the professor, who needs to combine them into one, in the order of each student's arrival. Jamie emailed a follow-up, saying that her list is in reverse order. Complete the steps to combine them into one list as follows: the contents of Drew's list, followed by Jamie's list in reverse order, to get an accurate list of the students as they arrived.
### Answer
```
def combine_lists(list1, list2):
  new_list = list2
  list1.reverse()
  for i in list1:
      new_list.append(i)
  return new_list
	
Jamies_list = ["Alice", "Cindy", "Bobby", "Jan", "Peter"]
Drews_list = ["Mike", "Carol", "Greg", "Marcia"]
print(combine_lists(Jamies_list, Drews_list))
```

### Question 4
Use a list comprehension to create a list of squared numbers (n*n). The function receives the variables start and end, and returns a list of squares of consecutive numbers between start and end inclusively. For example, squares(2, 3) should return [4, 9].
### Answer
```
def squares(start, end):
	return [int(n*n) for n in range(start,end+1)]

print(squares(2, 3)) # Should be [4, 9]
print(squares(1, 5)) # Should be [1, 4, 9, 16, 25]
print(squares(0, 10)) # Should be [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
```

### Question 5
Complete the code to iterate through the keys and values of the car_prices dictionary, printing out some information about each one.
### Answer
```
def car_listing(car_prices):
  result = ""
  for i in car_prices:
    result += f"{i} costs {car_prices[i]} dollars" + "\n"
  return result

print(car_listing({"<NAME>":19000, "<NAME>":55000, "<NAME>":13000, "<NAME>":24000}))
```

### Question 6
Taylor and Rory are hosting a party. They sent out invitations, and each one collected responses into dictionaries, with names of their friends and how many guests each friend is bringing. Each dictionary is a partial list, but Rory's list has more current information about the number of guests. Fill in the blanks to combine both dictionaries into one, with each friend listed only once, and the number of guests from Rory's dictionary taking precedence, if a name is included in both dictionaries. Then print the resulting dictionary.
### Answer
```
def combine_guests(guests1, guests2):
    new_dict = {}
    for i in guests1:
        if i in guests2:
            new_dict[i] = guests1[i]
        else:
            new_dict[i] = guests1[i]
    for i in guests2:
        if i not in new_dict:
            new_dict[i] = guests2[i]
    return new_dict


Rorys_guests = {"Adam": 2, "Brenda": 3, "David": 1, "Jose": 3, "Charlotte": 2, "Terry": 1, "Robert": 4}
Taylors_guests = {"David": 4, "Nancy": 1, "Robert": 2, "Adam": 1, "Samantha": 3, "Chris": 5}

print(combine_guests(Rorys_guests, Taylors_guests))
```

### Question 7
Use a dictionary to count the frequency of letters in the input string. Only letters should be counted, not blank spaces, numbers, or punctuation. Upper case should be considered the same as lower case. For example, count_letters("This is a sentence.") should return {'t': 2, 'h': 1, 'i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1}.
### Answer
```
def count_letters(text):
    list1 = []
    for word in text:
        if len(word) > 1:
            for letter in word:
                if letter.isalpha():
                    if letter.isupper():
                        list1.append(letter.lower())
                    else:
                        list1.append(letter)
        else:
            if word.isalpha():
                if word.isupper():
                    list1.append(word.lower())
                else:
                    list1.append(word)
    list2 = list(dict.fromkeys(list1))
    string = ""
    temp = 0
    for i in list2:
        if temp > 0:
            string += ", "
        temp += 1
        string += f"'{i}': {list1.count(i)}"
    return "{" + string + "}"


print(count_letters("AaBbCc"))
# Should be {'a': 2, 'b': 2, 'c': 2}

print(count_letters("Math is fun! 2+2=4"))
# Should be {'m': 1, 'a': 1, 't': 1, 'h': 1, 'i': 1, 's': 1, 'f': 1, 'u': 1, 'n': 1}

print(count_letters("This is a sentence."))
# Should be {'t': 2, 'h': 1, 'i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1}

```

### Question 8
What do the following commands return when animal = "Hippopotamus"?
```
>>> print(animal[3:6])
>>> print(animal[-5])
>>> print(animal[10:])

```
### Answer
pop, t, us

### Question 9
What does the list "colors" contain after these commands are executed?
```
colors = ["red", "white", "blue"]
colors.insert(2, "yellow")

```
### Answer
['red', 'white', 'yellow', 'blue']

### Question 10
What do the following commands return?
```
host_addresses = {"router": "192.168.1.1", "localhost": "127.0.0.1", "google": "8.8.8.8"}
host_addresses.keys()

```
### Answer
['router', 'localhost', 'google']
<file_sep>TCP and IP are two separate computer network protocols.

IP is the part that obtains the address to which data is sent. TCP is responsible for data delivery once that IP address has been found.

It's possible to separate them, but there isn’t really a point in making a difference between TCP and IP. Because they're so often used together, “TCP/IP” and the “TCP/IP model” are now recognized terminology.

Think of it this way: The IP address is like the phone number assigned to your smartphone. TCP is all the technology that makes the phone ring, and that enables you to talk to someone on another phone. They are different from one another, but they are also meaningless without one another.
<file_sep># Quiz

### Que 1

Which statements are true about App Engine? Choose all that are true (2 correct answers).

### Answer

    App Engine manages the hardware and networking infrastructure required to run your code.
    It is possible for an App Engine application's daily billing to drop to zero.

### Que 2

Name 3 advantages of using the App Engine Flexible Environment over App Engine Standard. Choose all that are true (3 correct answers).

### Answer

    You can install third-party binaries
    Your application can write to local disk
    You can SSH in to your application

### Que 3

Name 3 advantages of using the App Engine Standard Environment over App Engine Flexible. Choose all that are true (3 correct answers).

### Answer

    Google provides and maintains runtime binaries
    Billing can drop to zero if your application is idle
    Scaling is finer-grained

### Que 4

You want to do business analytics and billing on a customer-facing API. Which GCP service should you choose?

### Answer

Apigee Edge

### Que 5

You want to support developers who are building services in GCP through API logging and monitoring. Which GCP service should you choose?

### Answer

Cloud Endpoints

### Que 6

You want to gradually decompose a pre-existing monolithic application, not implemented in GCP, into microservices. Which GCP service should you choose?

### Answer

Apigee Edge
<file_sep>## Assignment

### Code

```
void setup()
{
  pinMode(9, OUTPUT);
  pinMode(A5, INPUT);
}

void loop()
{
  digitalWrite(9, LOW);
  if (analogRead(A5)<300)
    digitalWrite(9, HIGH);
  else
    digitalWrite(9, LOW);
}
```

### Circuit

![Photoresistor](./Photoresistor.png)
<file_sep># Week 1 Quiz
## Questions with same question number are the ones that vary from one quiz to another!!
### Question 1
The R language is a dialect of which of the following programming languages?
### Answer
S

### Question 1
R was developed by statisticians working at
### Answer
The University of Auckland

### Question 2
The definition of free software consists of four freedoms (freedoms 0 through 3). Which of the following is NOT one of the freedoms that are part of the definition? Select all that apply.
### Answer

    The freedom to sell the software for any price.

    The freedom to restrict access to the source code for the software.

    The freedom to prevent users from using the software for undesirable purposes.

### Question 3
In R the following are all atomic data types EXCEPT: (Select all that apply)
### Answer
`data frame, list, matrix, array, table`

### Question 4
If I execute the expression `x <- 4` in R, what is the class of the object x' as determined by the class()' function?
### Answer
numeric

### Question 5
What is the class of the object defined by `x <- c(4, TRUE)`?
### Answer
character

### Question 6
If I have two vectors `x <- c(1,3, 5)` and `y <- c(3, 2, 10)`, what is produced by the expression `rbind(x, y)`?
### Answer
a matrix with two rows and three columns

### Question 7
A key property of vectors in R is that
### Answer
elements of a vector all must be of the same class

### Question 8
Suppose I have a list defined as `x <- list(2, "a", "b", TRUE)`. What does `x[[2]]` give me? Select all that apply.
### Answer

    a character vector containing the letter "a".
    a character vector of length 1


### Question 9
Suppose I have a vector `x <- 1:4`and `y <- 2:3`. What is produced by the expression `x + y`?
### Answer
an integer vector with the values 3, 5, 5, 7.

### Question 9
Suppose I have a vector `x <- 1:4`and a vector `y <- 2`. What is produced by the expression `x + y`?
### Answer
a numeric vector with elements 3, 4, 5, 6.

### Question 10
Suppose I have a vector `x <- c(17, 14, 4, 5, 13, 12, 10)` and I want to set all elements of this vector that are greater than 10 to be equal to 4. What R code achieves this? Select all that apply.
### Answer

    x[x > 10] <- 4
    x[x >= 11] <- 4

### Question 11
Use the Week 1 Quiz Data Set to answer questions 11-20.
In the dataset provided for this Quiz, what are the column names of the dataset?
### Answer
 `names(hw1_data)`

  `Ozone, Solar.R, Wind, Temp, Month, Day`

### Question 12
Extract the first 2 rows of the data frame and print them to the console. What does the output look like?
### Answer
`hw1_data[c(1:2),]`
```
Ozone Solar.R Wind Temp Month Day
1    41     190  7.4   67     5   1
2    36     118  8.0   72     5   2
```

### Question 13
How many observations (i.e. rows) are in this data frame?
### Answer
`nrow(hw1_data)` i.e. 153

### Question 14
Extract the last 2 rows of the data frame and print them to the console. What does the output look like?
### Answer
`hw1_data[c(nrow(hw1_data)-1, nrow(hw1_data)),]`
```
Ozone Solar.R Wind Temp Month Day
152    18     131  8.0   76     9  29
153    20     223 11.5   68     9  30
```

### Question 15
What is the value of Ozone in the 47th row?
### Answer
`hw1_data[47, c('Ozone')]` i.e.21

### Question 16
How many missing values are in the Ozone column of this data frame?
### Answer
`table(factor(is.na(c(hw1_data$Ozone))))[2]` i.e.37

### Question 17
What is the mean of the Ozone column in this dataset? Exclude missing values (coded as NA) from this calculation.
### Answer
`mean(hw1_data$Ozone[!is.na(hw1_data$Ozone)])` i.e. 42.12931

### Question 18
Extract the subset of rows of the data frame where Ozone values are above 31 and Temp values are above 90. What is the mean of Solar.R in this subset?
### Answer
`temp <- complete.cases(hw1_data$Ozone, hw1_data$Solar.R, hw1_data$Temp)
      mean(hw1_data$Solar.R[temp & hw1_data$Ozone > 31 & hw1_data$Temp > 90])`
      i.e. 212.8

### Question 19
What is the mean of "Temp" when "Month" is equal to 6?
### Answer
`temp <- complete.cases(hw1_data$Month, hw1_data$Temp)
      mean(hw1_data$Temp[temp & hw1_data$Month == 6])`
      i.e. 79.1

### Question 20
What was the maximum ozone value in the month of May (i.e. Month is equal to 5)?
### Answer
`max(hw1_data$Ozone[hw1_data$Month==5 & !is.na(hw1_data$Ozone)])` i.e. 115
<file_sep>temp = []
for i in range(3):
    temp.append(int(input('Enter number:')))

print(sorted(temp))
<file_sep>## Quiz

### Question 1

My watch displays the current weather downloaded from the Internet. My watch is an IoT device.

### Answer

True

### Question 2

Which of the following could be an IoT device?

### Answer

    a lamp
    a couch
    a pen
    all of the above (Corect)

### Question 3

An IoT device can most easily be differentiated from a standard computer based on

### Answer

interface with the user and the world

### Question 4

The following trend is NOT related to the growth in IoT technology:

### Answer

Increase in computer monitor size over time.

### Question 5

IoT devices are likely to be more vulnerable to cyberattacks than standard computers.

### Answer

True

### Question 6

Which of these security approaches is feasible for most IoT devices?

### Answer

Regular installation of product firmware updates.

### Question 7

IoT devices gather private information about users. Which statement is most true about the security of that data?

### Answer

Users must rely on data-collecting agencies to securely store and transmit their data.

### Question 8

Although people are aware of the dangers of cyberattacks, they often do not understand the risks to IoT devices.

### Answer

True
<file_sep>## Assignment

### Project Title

    S32K1 and  MAC57D5xx

### Research two microcontrollers and provide information about them from their datasheets. There are several microcontroller manufacturers that you can investigate including Atmel, Microchip, Freescale, TI, etc. For each microcontroller, report the following information. (Be sure to include a link to an online reference where you found this information.)

### Clock frequency

### Bitwidth of the datapath

### Size of Flash memory

### Number of pins

### Does the microcontroller contain an Analog-to-Digital Converter? If so, how many bits of precision does it have?

    1. S32K1
    Clock Frequency: 112 MHz
    Bit width: 32 bit
    Flash Size: 2 MB
    Number of pins: Up to 156
    Analog to Digital Convertor: LQFP 144
    https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/s32k-automotive-mcus/s32k1-microcontrollers-for-general-purpose:S32K

    2. MAC57D5xx:
    Clock Frequency:  4-40 MHz
    Bit width: 32 Bit
    Flash Size: 4 MB
    Number of pins: 32
    Analog to Digital Convertor: MBIST
    https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/mac57d5xx-mcus/ultra-reliable-multi-core-arm-based-mcu-for-clusters-and-display-management:MAC57D5xx

### Research the Arduino and Raspberry Pi platforms.

### Indicate if there are operating systems which can be used on each platform. If there are, list those operating systems

### State whether the operating systems are open source or not.

    1. Arduino:
    No operating system
    2. Raspberry Pi
    Raspbian based on Linux kernel
    Open Source
<file_sep>## Quiz

### Question 1

What is DHCP used for?

### Answer

It is a network protocol used to assign IP addresses.

### Question 2

What is an SSH server?

### Answer

A program which responds to incoming ssh requests

### Question 3

When an ssh client is invoked at the command-line with the “ssh” command, what other argument must be provided on the command line?

### Answer

A domain name or IP address to connect to

### Question 4

What command will reveal the IP address of your Raspberry Pi?

### Answer

ifconfig

### Question 5

What is a fair definition of the term "protocol"?

### Answer

A set of rules for communication

### Question 6

What does an IP address uniquely identify?

### Answer

A host communicating on the Internet

### Question 7

How big is a port TCP/UDP number?

### Answer

16 bits

### Question 8

The nslookup command will show the IP address corresponding to a given domain name.

### Answer

True
<file_sep># Quiz

### Que 1

True or False: In Google Cloud IAM: if a policy applied at the project level gives you Owner permissions, your access to an individual resource in that project might be restricted to View permission if someone applies a more restrictive policy directly to that resource.

### Answer

False

### Que 2

True or False: All Google Cloud Platform resources are associated with a project.

### Answer

True

### Que 3

Service accounts are used to provide which of the following? (Choose all that are correct. Choose 3 responses.)

### Answer

    A way to restrict the actions a resource (such as a VM) can perform
    Authentication between Google Cloud Platform services
    A way to allow users to act with service account permissions

### Que 4

How do GCP customers and Google Cloud Platform divide responsibility for security?

### Answer

Google takes care of the lower parts of the stack, and customers are responsible for the higher parts.

### Que 5

Which of these values is globally unique, permanent, and unchangeable, but chosen by the customer?

### Answer

The project ID

### Que 6

Consider a single hierarchy of GCP resources. Which of these situations is possible? (Choose all that are correct. Choose 3 responses.)

### Answer

    There is an organization node, and there is at least one folder.
    There is no organization node, and there are no folders.
    There is an organization node, and there are no folders.

### Que 7

What is the difference between IAM primitive roles and IAM predefined roles?

### Answer

Primitive roles affect all resources in a GCP project. Predefined roles apply to a particular service in a project.

### Que 8

Which statement is true about billing for solutions deployed using Cloud Marketplace (formerly known as Cloud Launcher)?

### Answer

You pay only for the underlying GCP resources you use, with the possible addition of extra fees for commercially licensed software.
<file_sep># Converting a wired Canon printer into wireless using a Raspberry Pi

![Printer](./Resources/printer.jpeg)

## 1. Component Testing:

### The printer:

    Test the printer with a normal computer that has Windows on it
    Test the printer with a normal computer that has Linux on it
    Test the printer on Raspberry Pi using CUPS software
    Test the printer on Raspberry Pi using a shell command

### The server code:

    Test the server code by receiving a simple message
    Test the server code by receiving a file

### The client code:

    Test the client code by sending a simple message
    Test the client code by sending a file

### The LEDs:

    Test each LED individually
    Test LEDs together

## 2. Integration Testing:

### The printer & The server code:

    Test the server code by receiving a file and printing it

### The server code & The client code:

    Send a simple message from the client to the server
    Send a file from the client to the server

### The LEDs & The server code:

    Test LEDs on the server code

### The whole system:

    Send a file from the client to the server, print the file, and turn LEDs into high and low
<file_sep>def EuclidGCD(a, b):
    if b == 0:
        return a
    
    rem = a % b
    return EuclidGCD(b, rem)

def lcm(a, b):
    gcd = EuclidGCD(a, b)
    num = a / gcd
    return int(num*b)


if __name__ == '__main__':
    a, b = map(int, input().split())
    print(lcm(a, b))

<file_sep>#! /usr/bin/env python3

import os
import requests
import re

desc_path = os.path.expanduser('~') + '/supplier-data/descriptions/'
image_path = os.path.expanduser('~') + '/supplier-data/images/'

text_files = sorted(os.listdir(desc_path))
jpeg_images = sorted([image_name for image_name in os.listdir(
    image_path) if '.jpeg' in image_name])

list_content = []
image_counter = 0

for file in text_files:
    format = ['name', 'weight', 'description']

    with open(desc_path + file, 'r') as f:
        data = {}
        contents = f.read().split("\n")[0:3]
        contents[1] = int((re.search(r'\d+', contents[1])).group())

        counter = 0
        for content in contents:
            data[format[counter]] = content
            counter += 1
        data['image_name'] = jpeg_images[image_counter]

        list_content.append(data)
        image_counter += 1

for item in list_content:
    resp = requests.post('http://35.202.223.143/fruits/', json=item)
    if resp.status_code != 201:
        raise Exception('POST error status={}'.format(resp.status_code))
    print('Created feedback ID: {}'.format(resp.json()["id"]))
<file_sep># Quiz

### Que 1

No resources in GCP can be used without being associated with...

### Answer

A project

### Que 2

A budget is set at $500 and an alert is set at 100%. What happens when the full amount is used?

### Answer

A notification email is sent to the Billing Administrator.

### Que 3

How do quotas protect GCP customers?

### Answer

By preventing uncontrolled consumption of resources.
<file_sep>## Quiz

### Question 1

What type of connector does an Arduino UNO not contain?

### Answer

HDMI Connector

### Question 2

How many microcontrollers are available for user programming on the Arduino UNO?

### Answer

1

### Question 3

The Arduino UNO contains a user-controllable LED connected to which pin?

### Answer

Digital pin 13

### Question 4

True or False: Analog pin A0 can be used as an analog output.

### Answer

False

### Question 5

Through what interface is the bootloader typically reprogrammed?

### Answer

ICSP

### Question 6

True or False: The schematic shows the connections between components and their placement on the board.

### Answer

False

### Question 7

What operation in the IDE triggers code to be written into the memory of the Arduino?

### Answer

Upload

### Question 8

Which statement about the serial monitor is NOT true?

### Answer

The serial monitor is a program that executes on the Arduino.
