##### Question

In: Computer Science

# Given the names of employees in an office: employees = ["Matthew", "Anna", "Curtis", "Jane", "Yang", "Tammie"]...

Given the names of employees in an office: employees = ["Matthew", "Anna", "Curtis", "Jane", "Yang", "Tammie"]

Using the Random library in Python, create two codes that: A. Draws a random sample (without replacement) of 2 employees. Saves and displays the sample. B: Draws a random sample (with replacement) of 4 employees. Save and Displays the sample

## Solutions

##### Expert Solution

A)

.

import random

# Given the names of employees in an office:

employees = ["Matthew", "Anna", "Curtis", "Jane", "Yang", "Tammie"]

# A. Draws a random sample(without replacement) of 2 employees.

first_sample = random.sample(employees, 2)

# Saves and displays the sample.

print(first_sample)

.

Screenshot:

Output:

.

B)

.

import random

# Given the names of employees in an office:

employees = ["Matthew", "Anna", "Curtis", "Jane", "Yang", "Tammie"]

# B: Draws a random sample(with replacement) of 4 employees.

second_sample = []

for i in range(4):

second_sample += random.sample(employees, 1)

# Save and Displays the sample

print(second_sample)

.

Screenshot:

Output:

.

## Related Solutions

##### You are given a list of all employees. You group the names by department (Logistics, Sales,...
You are given a list of all employees. You group the names by department (Logistics, Sales, IT, Human Resource). Suppose you select all employees in Sales. What type of sampling method did you use to select the employees? Explain your reasoning.
##### Anna is a 45-year-old female that presented to her physician’s office for her annual check-up. Anna...
Anna is a 45-year-old female that presented to her physician’s office for her annual check-up. Anna has a history of diabetes, obesity, and noncompliance with diet and medications to control her diabetes. She a single mother of three teenagers and smokes regularly. During the history review, Anna shares with you that she has not been feeling like herself for the past six months, she has been unusually tired and thought that she felt a lump in her right breast during...
##### Matthew needs a long-term mortgage to finance a new office building and is trying to decide...
Matthew needs a long-term mortgage to finance a new office building and is trying to decide between two loan proposals. Loan #1 is a 10-year term, 20-year amortization loan. Loan #2 is a 10-year term, interest-only loan. However, as is often the case, Matthew is very confused. He notes that both the upfront fee and contract mortgage rate are slightly higher with the interest-only loan compared to the partial amortization loan. As a result, Matthew feels this is backwards since...
##### The names of the employees of Hogan Thrift Shop are listed on the following payroll register....
The names of the employees of Hogan Thrift Shop are listed on the following payroll register. Employees are paid weekly. The marital status and the number of allowances claimed are shown on the payroll register, along with each employee's weekly salary, which has remained the same all year. Complete the payroll register for the payroll period ending December 22, the 51st weekly payday. The state income tax rate is 3.1% of total earnings, the city income tax rate is 1%...
##### The names of the employees of Hogan Thrift Shop are listed on the following payroll register....
The names of the employees of Hogan Thrift Shop are listed on the following payroll register. Employees are paid weekly. The marital status and the number of allowances claimed are shown on the payroll register, along with each employee's weekly salary, which has remained the same all year. Complete the payroll register for the payroll period ending December 21, the 51st weekly payday. The state income tax rate is 2% of total earnings, the city income tax rate is 1.5%...
##### The names of the employees of Hogan Thrift Shop are listed on the following payroll register....
The names of the employees of Hogan Thrift Shop are listed on the following payroll register. Employees are paid weekly. The marital status and the number of allowances claimed are shown on the payroll register, along with each employee's weekly salary, which has remained the same all year. Complete the payroll register for the payroll period ending December 21, the 51st weekly payday. The state income tax rate is 2% of total earnings, the city income tax rate is 1.5%...
##### Jane Heinlein is the payroll accountant for Sia Lights of Carter, Nebraska. The employees of Sia...
Jane Heinlein is the payroll accountant for Sia Lights of Carter, Nebraska. The employees of Sia Lights are paid biweekly. An employee, Melinda Gunnarson, comes to her on September 14 and requests a pay advance of $825, which she will pay back in equal parts on the September 28 and October 12 paychecks. Melinda is single with one withholding allowance and is paid$32,500 per year. She contributes 1 percent of her pay to a 401(k) plan and has \$25...
##### When new physicians or employees are hired in a physician’s practice, the office manager or office...
When new physicians or employees are hired in a physician’s practice, the office manager or office administrator typically has the responsibility to set the physician or employee up in the PM and EHR system(s) as part of the security measures. Explain each type of security role in Prime Suite.