<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Week 1 - Getting Started
Step1:  Python Summary
Further information
More information is usually available with the help function. Using ? brings up the same information in ipython. 
Using the dir function lists all the options available from a variable.
help(np)
np?
dir(np)
Step2:  Variables
A variable is simply a name for something. One of the simplest tasks is printing the value of a variable.
Printing can be customized using the format method on strings.
Step3:  Types
A number of different types are available as part of the standard library. The following links to the documentation provide a summary.
https
Step4:  Conditionals
https
Step5:  Loops
https
Step6:  Functions
https
Step7:  Numpy
http
Step8:  Exercises
Step9:  Print the variable a in all uppercase
Print the variable a with every other letter in uppercase
Print the variable a in reverse, i.e. god yzal ...
Print the variable a with the words reversed, i.e. ehT kciuq ...
Print the variable b in scientific notation with 4 decimal places
Step10:  Print the items in people as comma seperated values
Sort people so that they are ordered by age, and print
Sort people so that they are ordered by age first, and then their names, i.e. Bob and Charlie should be next to each other due to their ages with Bob first due to his name.
Step11:  Write a function that returns the first n prime numbers
Given a list of coordinates calculate the distance covered travelling between all the points in order given using the Euclidean distance
Given a list of coordinates arrange them in such a way that the distance traveled is minimized (the itertools module may be useful).
Step12:  Print the standard deviation of each row in a numpy array
Print only the values greater than 90 in a numpy array
From a numpy array display the values in each row in a seperate plot (the subplots method may be useful)
<ASSISTANT_TASK:>
Python Code:
import numpy as np
print("Numpy:", np.__version__)
Explanation: Week 1 - Getting Started
End of explanation
dir(np)
Explanation: Python Summary
Further information
More information is usually available with the help function. Using ? brings up the same information in ipython. 
Using the dir function lists all the options available from a variable.
help(np)
np?
dir(np)
End of explanation
location = 'Bethesda'
zip_code = 20892
elevation = 71.9
print("We're in", location, "zip code", zip_code, ", ", elevation, "m above sea level")
print("We're in " + location + " zip code " + str(zip_code) + ", " + str(elevation) + "m above sea level")
print("We're in {0} zip code {1}, {2}m above sea level".format(location, zip_code, elevation))
print("We're in {0} zip code {1}, {2:.2e}m above sea level".format(location, zip_code, elevation))
Explanation: Variables
A variable is simply a name for something. One of the simplest tasks is printing the value of a variable.
Printing can be customized using the format method on strings.
End of explanation
# Sequences
# Lists
l = [1,2,3,4,4]
print("List:", l, len(l), 1 in l)
# Tuples
t = (1,2,3,4,4)
print("Tuple:", t, len(t), 1 in t)
# Sets
s = set([1,2,3,4,4])
print("Set:", s, len(s), 1 in s)
# Dictionaries
# Dictionaries map hashable values to arbitrary objects
d = {'a': 1, 'b': 2, 3: 's', 2.5: 't'}
print("Dictionary:", d, len(d), 'a' in d)
Explanation: Types
A number of different types are available as part of the standard library. The following links to the documentation provide a summary.
https://docs.python.org/3.5/library/stdtypes.html
https://docs.python.org/3.5/tutorial/datastructures.html
Other types are available from other packages and can be created to support special situations.
A variety of different methods are available depending on the type.
End of explanation
import random
if random.random() < 0.5:
    print("Should be printed 50% of the time")
elif random.random() < 0.5:
    print("Should be primted 25% of the time")
else:
    print("Should be printed 25% of the time")
Explanation: Conditionals
https://docs.python.org/3.5/tutorial/controlflow.html
End of explanation
for i in ['a', 'b', 'c', 'd']:
    print(i)
else:
    print('Else')
    
for i in ['a', 'b', 'c', 'd']:
    if i == 'b':
        continue
    elif i == 'd':
        break
    print(i)
else:
    print('Else')
Explanation: Loops
https://docs.python.org/3.5/tutorial/controlflow.html
End of explanation
def is_even(n):
    return not n % 2
print(is_even(1), is_even(2))
def first_n_squared_numbers(n=5):
    return [i**2 for i in range(1,n+1)]
print(first_n_squared_numbers())
def next_fibonacci(status=[]):
    if len(status) < 2:
        status.append(1)
        return 1
    status.append(status[-2] + status[-1])
    return status[-1]
print(next_fibonacci(), next_fibonacci(), next_fibonacci(), next_fibonacci(), next_fibonacci(), next_fibonacci())
def accepts_anything(*args, **kwargs):
    for a in args:
        print(a)
    print(type(args))
    for k in kwargs:
        print(k, kwargs[k])
        
accepts_anything(1,2,3,4, a=1, b=2, c=3)
# For quick and simple functions a lambda expression can be a useful approach. 
# Standard functions are always a valid alternative and often make code clearer.
f = lambda x: x**2
print(f(5))
people = [{'name': 'Alice', 'age': 30}, 
          {'name': 'Bob', 'age': 35}, 
          {'name': 'Charlie', 'age': 35}, 
          {'name': 'Dennis', 'age': 25}]
print(people)
people.sort(key=lambda x: x['age'])
print(people)
Explanation: Functions
https://docs.python.org/3.5/tutorial/controlflow.html
End of explanation
a = np.array([[1,2,3], [4,5,6], [7,8,9]])
print(a)
print(a[1:,1:])
a = a + 2
print(a)
a = a + np.array([1,2,3])
print(a)
a = a + np.array([[10],[20],[30]])
print(a)
print(a.mean(), a.mean(axis=0), a.mean(axis=1))
import matplotlib.pyplot as plt
%matplotlib inline
x = np.linspace(0, 3*2*np.pi, 500)
plt.plot(x, np.sin(x))
plt.show()
Explanation: Numpy
http://docs.scipy.org/doc/numpy/reference/
End of explanation
a = "The quick brown fox jumps over the lazy dog"
b = 1234567890.0
Explanation: Exercises
End of explanation
print(a.upper())
upper = True
soln = ''
for i in a:
    if upper == True:
        soln += i.upper()
    else:
        soln += i
    if i != ' ':
        upper = not upper
print(soln)
def reverse_string(s):
    al = list(s)
    al.reverse()
    return ''.join(al)
print(reverse_string(a))
words = a.split(' ')
print(' '.join([reverse_string(i) for i in words]))
print('{0:.4e}'.format(b))
people = [{'name': 'Charlie', 'age': 35}, 
          {'name': 'Alice', 'age': 30}, 
          {'name': 'Eve', 'age': 20},
          {'name': 'Gail', 'age': 30},
          {'name': 'Dennis', 'age': 25},
          {'name': 'Bob', 'age': 35},
          {'name': 'Fred', 'age': 25},]
Explanation: Print the variable a in all uppercase
Print the variable a with every other letter in uppercase
Print the variable a in reverse, i.e. god yzal ...
Print the variable a with the words reversed, i.e. ehT kciuq ...
Print the variable b in scientific notation with 4 decimal places
End of explanation
for i in people:
    print('{0},{1}'.format(i['name'], i['age']))
    
for i in people:
    print('{0:<10},{1}'.format(i['name'], i['age']))
def key_age(x):
    return x['age']
people.sort(key=key_age)
print(people)
people.sort(key=lambda x: x['name'])
people.sort(key=key_age)
print(people)
coords = [(0,0), (10,5), (10,10), (5,10), (3,3), (3,7), (12,3), (10,11)]
Explanation: Print the items in people as comma seperated values
Sort people so that they are ordered by age, and print
Sort people so that they are ordered by age first, and then their names, i.e. Bob and Charlie should be next to each other due to their ages with Bob first due to his name.
End of explanation
def first_n_primes(n):
    primes = []
    i = 2
    while len(primes) < n:
        for p in primes:
            if i % p == 0:
                break
        else:
            primes.append(i)
        i += 1
    return primes
print(first_n_primes(5))
def distance(coords):
    distance = 0
    for p1, p2 in zip(coords[:-1], coords[1:]):
        distance += ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5
    return distance
        
print(distance(coords))
assert distance([(0,0), (10,0)]) == 10
assert distance([(0,0), (-10, 0)]) == 10
assert distance([(0,0), (3,4)]) == 5
import itertools
all_options = []
for option in itertools.permutations(coords, len(coords)):
    all_options.append((option, distance(option)))
all_options.sort(key=lambda x: x[1])
print(all_options[0])
np.random.seed(0)
a = np.random.randint(0, 100, size=(10,20))
Explanation: Write a function that returns the first n prime numbers
Given a list of coordinates calculate the distance covered travelling between all the points in order given using the Euclidean distance
Given a list of coordinates arrange them in such a way that the distance traveled is minimized (the itertools module may be useful).
End of explanation
print(a.std())
print(a)
print(a.std(axis=1))
print(a[a>90])
import matplotlib.pyplot as plt
%matplotlib inline
fig, axes = plt.subplots(5, 2, figsize=(16,12))
for i, ax in zip(range(a.shape[0]), axes.flatten()):
    ax.plot(a[i])
plt.show()
Explanation: Print the standard deviation of each row in a numpy array
Print only the values greater than 90 in a numpy array
From a numpy array display the values in each row in a seperate plot (the subplots method may be useful)
End of explanation
<END_TASK>