In [4]:
    
odds = [1,3,5,7]
print('Odds are:', odds)
    
    
In [8]:
    
print(odds[0], odds[-1])
    
    
In [9]:
    
for number in odds:
    print(number)
    
    
In [11]:
    
print(odds[1])
print(odds)
    
    
In [12]:
    
odds[1] = 11
print(odds)
    
    
In [13]:
    
string = 'oxygen'
print(string[1])
    
    
In [14]:
    
string[1] = i
print(string)
    
    
In [23]:
    
names = ['Newton', 'Darwing', 'Turing']
print('Names list is currently:', names)
names[1] = 'Darwin'
print('Names list is now:', names)
    
    
In [21]:
    
names[1] = 'Darwin'
    
names
In [22]:
    
names
    
    Out[22]:
In [24]:
    
name = 'Bell'
name[0] = 'b'
    
    
In [25]:
    
x = [['pepper', 'zucchini', 'onion'],['apple', 'pear', 'banana']]
    
In [26]:
    
x
    
    Out[26]:
In [27]:
    
print(x)
    
    
In [28]:
    
for list in x:
    print(list)
    
    
In [36]:
    
# Our master list
print(x)
# Find first thing in first list
print(x[0][0])
# Find first letter of first thing in first list
print(x[0][0][0])
    
    
In [35]:
    
# Find first letter of first thing in first list
x[0][0][0]
    
    Out[35]:
In [37]:
    
55
100
    
    Out[37]:
In [38]:
    
print(odds)
    
    
In [41]:
    
odds.append(13)
print('odds list after adding a number:', odds)
    
    
In [44]:
    
del odds[-1]
print(odds)
    
    
In [48]:
    
odds.reverse()
print(odds)
    
    
In [46]:
    
odds.reverse()
    
    Out[46]:
In [53]:
    
string = 'hello'
new_list = []
for x in string:
    new_list.append(x)
    print(new_list)
print(new_list)
    
    
In [60]:
    
num = 101
if num > 100:
    print('Greater!')
else: 
    print('Lesser!')
print('All done')
    
    
In [68]:
    
num = 1000
if num > 0:
    print(num, 'is positive')
elif num == 0:
    print(num, 'is zero')
else:
    print(num, 'is negative')
    
    
In [70]:
    
if (1 > 0) and (-1 >0): 
    print('True')
else: 
    print('False')
    
    
In [73]:
    
if (1 > 0) or (-1 >0): 
    print('... at least one thing is True')
else: 
    print('False')
    
    
In [79]:
    
if '':
    print("empty string is true")
if 'word':
    print("some string is true")
if [1,2,3]:
    print('some list is true')
if 0:
    print('zero is true')
if 1:
    print('one is true')
    
    
In [92]:
    
a = 100
b = 100
if a > 0.9*b:
    print('TRUE')
elif a < 1.1*b:
    print('TRUE')
    
    
In [93]:
    
x = 10
    
In [94]:
    
x = x+2
x
    
    Out[94]:
In [96]:
    
x += 2
x
    
    Out[96]:
In [4]:
    
def fahr_to_kelvin(temp):
    newtemp = ((temp - 32)*(5/9)) + 273.15
    return newtemp
    
In [6]:
    
res = fahr_to_kelvin(0)
print (res)
    
    
In [7]:
    
x = 11
print(x)
x = float(x)
print(type(x))
    
    
In [8]:
    
5/9
    
    Out[8]:
In [9]:
    
def kelvin_to_celcius(temp_k):
    converted = temp_k - 273.15
    return converted
    
In [12]:
    
kelvin_to_celcius(0)
    
    Out[12]:
In [13]:
    
def fahr_to_celcius(temp_f):
    temp_k = fahr_to_kelvin(temp_f)
    result = kelvin_to_celcius(temp_k)
    return result
    
In [16]:
    
print('freezing point of water in celsius', fahr_to_celcius(32))
    
    
In [17]:
    
a = 'Hi'
b = ' everyone'
a + b
    
    Out[17]:
In [32]:
    
def join_words(word1, word2):
    join = word1 + word2
    return join
    
In [34]:
    
join_words('My name is ', 'Jack')
    
    Out[34]:
In [51]:
    
def abbrev(outer):
    return outer [0] + outer [-1]
    
In [52]:
    
outer = ('helium')
    
In [53]:
    
abbrev(outer)
    
    Out[53]:
In [61]:
    
my_numbers = [1,2,3,4,5,6,7,8,9,10]
def sum_numbers(numbers_to_multiply):
    new_numbers = []
    for x in my_numbers:
        result = numbers_to_multiply*x
        new_numbers.append(result)
        
    return new_numbers
    
In [62]:
    
sum_numbers(5)
    
    Out[62]:
sum_numbers(2)
In [63]:
    
sum_numbers(2)
    
    Out[63]:
In [64]:
    
my_numbers = [1,2,3,4,5,6,7,8,9,10]
def sum_numbers(numbers_to_multiply):
    new_numbers = []
    for x in my_numbers:
        new_numbers.append(numbers_to_multiply*x)
        
    return new_numbers
    
In [65]:
    
sum_numbers(2)
    
    Out[65]:
In [ ]: