# Print simple text to the console
print("Hello World")
# store value in a variable
a=5
a
# import a package from a library
import numpy as np
# generate random data () creates input
# period opens data set within the program (random in np)
data = [np.random.standard_normal() for i in range (7)]
data
# pos index 0-num, or last one is -1 and go backwards fromthere
data[6]
data[2:5]
# create function
def add_numbers(a, b):
"""
add two numbers together
returns
the_sum : type of arguments
"""
return a+b
add_numbers(5, 9)
# integer
a=100
a
# type(a) to check what kind of number the variable is
# float (includes decimal)
b=100.7
b
#complex
c=100+200j
c
d=300+500j
d
e=c+d
e
type(e)
a=[4,6, 3, 2, 5]
a
a[3]
#index 3 is the fourth number, always starts at 0 then 1
type(a)
b=['physics','chemistry',91,100]
b
b[-1]
'91' in b
# to see if in list
b.index(91)
#what is the location for a value in a list
a = (1,2,3,4,5)
a
b = (3,5,6)
b
a + b
# notice it added them in order a to b not numerical
a*2
a*= 3
print(a)
capitals = {'France':'Paris', 'Germany': 'Berlin', 'Italy': 'Rome'}
capitals
capitals2 = {'United Kingdom': 'London', 'United States': 'Washington' }
capitals2
capitals.update(capitals2)
#dot function update to add to the dictionary
capitals
set([2,2,2,1,3,3])