# 代写C代码 代做C程序 C辅导 C家教

## 微信: ittutor QQ: 14061936 Email: ittutor@qq.com

### 导航

Python and Applications to Business Analytics

In statistics, one of the most used statistic is the standard error. From the Wikipedia
article describing the standard error, it is defined as the standard deviation of its sampling
distribution. The sampling distribution of a population mean is generated by repeated sampling and recording of the means obtained. This forms a distribution of different means,
and this distribution has its own mean and variance. Mathematically, the variance of the
sampling distribution obtained is equal to the variance of the population divided by the
sample size. This is because as the sample size increases, sample means cluster more closely
around the population mean.
Create a Python computer program to compute the mean and standard error given a population. For this assignment, assume that the population consists of all whole numbers (integers)
from and including 0 to and including 10000. Obviously the mean is 5000, but let’s assume
that we sample our population for n samples, where n = [10; 20; 50; 100; 200; 500; 1000; 5000].
Determine and output the sample mean and standard error.
The following Python related documentation will prove useful:
• Module random
Exercise 2. Vigenere Cipher
As you may recall from class, code was given to encrypt text via the Caesar cipher. The
Caesar cipher is a substitution cipher in which each letter in the text is ’shifted’ a certain
number of places down the alphabet. For example, with a shift of 1, A would be replaced by
B, B would become C, and so on. The method is named after Julius Caesar, who apparently
used it to communicate with his generals.
The Caesar cipher is rather easy to break, because in the English language, the letter ’E’ is
the most commonly used letter. Vowels are used more frequently than consonants with the
consonants ’R’, ’S’, ’T’, ’L’, and ’N’ being the most used. Any frequency analysis can easily
piece together what the ’shift’ number is analyzing the frequency of letters in the encrypted
text.
1
First described in 1553, the Vigenere cipher is a method of encrypting text using a series
of interwoven Caesar ciphers. From the Wikipedia article describing the Vigenere cipher,
one would need to input a key, which is repeated until the repeated key length is the same
length as the text to be encrypted. Iterating over the text and key, one sees that the ’shift’ is
essentially changing for each letter within text. All that is required is that both participants
in the encrypted dialogue must agree to use the same key.
Create a Vigenere cipher Python program utilizing the following steps:
1. Ask the user to enter a string message (the text, or in the parlance of cryptography,
the plaintext). Use the Python input function.
2. Ask the user to enter a key. Again, use the Python input function. Please error check
that the key is valid. A valid key will consist only letters.
3. Encrypt the user’s message with the Vigenere cipher and print the encrypted messaged
to the screen. Only encrypt letters. Any non-letters should be kept unaltered.
4. Decrypt the encrypted message back to a plaintext message and print the plaintext to
the screen.
The following Python related documentation will prove useful:
• Common string operations
• Regular expression operations
2