<jupyter_start><jupyter_text>This notebook is for Sergio to type the commands from book by <NAME>: "A whirlwind tour of python".https://github.com/jakevdp/WhirlwindTourOfPython<jupyter_code>midpoint = 5

lower = []; upper = []

for i in range(10):
  if (i < midpoint):
    lower.append(i)
  else:
    upper.append(i)
    
print("Lower:", lower)
print("Upper:", upper)
      
L = [4, 2, 3, 1]
L.sort()
print(L)
print("first value:", 1)
x = 1; print(x)
x = 'hello'; print(x)
x = [1, 2, 3]; print(x)
x = [1, 2, 3]; print(x)
y = x; print(y)
x.append(4); print(y)
x = "something else"
print(x)
print(y)
x = 10
y = x
x += 5
print("x =", x)
print("y=", y)
x = 4
print(type(x))
x = "hello"
print(type(x))
x = 3.14159
print(type(x))
L = [1, 2, 3]
L.append(100)
print(L)
x = 4.5
print(x.real, "+", x.imag, 'i')
x = 4.5
x.is_integer()
x = 4.0
print(x.is_integer())
type(x.is_integer())
print(11//2)
a = [1, 2, 3]
b = [[10], [100], [1000]]
a @ b
bin(10)
bin(4)
4 | 10
bin(14)
L = [1, 2, 9, 6]
print(L)
L.sort()
print(L)
L += [44]
print(L)
25 % 2 == 1
66 % 2 == 1
a = 25
15 < a < 30
x = 4
(x < 6) and (x > 2)
(x > 10) or (x % 2 == 0)
not (x < 6)
(x > 1) != (x < 10)
a = [1, 2, 3]
b = [1, 2, 3]
a == b
a is b
a is not b
b = a
a is b

1 in [1, 2, 3]
2 not in [1, 2, 3]
x = 1
type(x)
2 ** 200
5 /2
5 // 2
x = 0.000005
print(x)
y = 5e-6
print(y)
print(x == y)
x = 1400000.00
print(x)
y = 1.4e6
print(y)
print(x == y)
float(1)
0.1 + 0.2 == 0.3
print("0.1 = {0:.17f}".format(0.1))
print("0.2 = {0:.17f}".format(0.2))
print("0.3 = {0:.17f}".format(0.3))
1/8
complex(1, 2)
y = 1 + 3j
print(y)
c = 3 + 4j
print(c.real)
print(c.imag)
c.conjugate()
abs(c)
message = "what do you like?"
response = 'spam'
len(response)
message.capitalize()
response.upper()
message + response
5 * response
message
message[1]
type(None)
return_value = print('abc')
type(print(return_value))
result = (4 < 5)
result
type(result)
type(False)
print(True, False)
bool(2014)
bool(0)
bool(3.1415)
bool(None)
bool("")
bool("abc")
bool([1, 2, 3])
bool([])
L = [2, 3, 5, 7]
len(L)
L.append(11)
L
L + [13, 17, 19]
L.sort()
L
L = [2, 5, 1, 6, 3, 4]
L.sort()
L
len(L)
L = [1, 'two', 3.14, [0, 3, 5]]
L[3][2]
L = [2, 3, 5, 7, 11]
L[1]
L[-1]
L[-2]
L
L[0:3]
L[:3]
L
L[-3:]
L[-2:]
L[-2]
L
L[::2]
L[::-1]
L[0] = 100
print(L)
L[1:3] = [55, 56]
print(L)
# Tuples
t = (1, 2, 3)
t = 1, 2, 3
print(t)
len(t)
t[0]
t[1] = 4
t.append(4)
x = 0.125
x.as_integer_ratio()
numerator, denominator = x.as_integer_ratio()
print(numerator / denominator)
print("numerator =", numerator)
print("denominator = ", denominator)
1 / 8
numbers = {'one':1, 'two':2, 'three': 3}
numbers['one']
print(numbers['three'])
numbers
numbers['ninety'] = 90
print(numbers)
primes = {2, 3, 5, 7, 11}
odds = {1, 3, 5, 7, 9, 11}
print("primes = ", primes)
print("odds = ", odds)
primes | odds
primes.union(odds)
primes & odds
primes.intersection(odds)
primes - odds
primes.difference(odds)
primes ^ odds
print(primes.symmetric_difference(odds))
print(odds.symmetric_difference(primes))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.231024196221412, 'fraction_numerical': 0.09181305933046072, 'mean_word_length': 3.852090032154341, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '74644', 'license': 'CC0-1.0', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1464, 'n_words': 414, 'path': '2019_08_27_Sergio_WhirlwindTourOfPython.ipynb', 'repo_name': 'sergiomorenoh/WhirlwindTourOfPython', 'size': '3027'}