view these slides here:
goo.gl/KWWMT
“When ... the child lives with its parents, who are savages, and though he may learn to read and write, his habits and training mode of thought are Indian. ... Indian children should be withdrawn as much as possible from the parental influence ... put them in central training industrial schools where they will acquire the habits and modes of thought of white men."
def simple_example():
a = 20
b = 4
print(a / b)
a = 20
b = 4
a = 20
b = 4
print(a / b)
def simple_example():
# Simple math example
a = 20
b = 4
print(a / b)
result = 8 / 2
print(result)
python review.py
py.exe review.py
# Call the function.
result = divide_by_two(8)
print(result)
divide_by_two()
def multiply(a, b):
return a * b
result = multiply(3, 4)
def divide_by_two(value):
return value / 2
# Call the function.
result = divide_by_two(8)
print(result)
a = 5
b = 4
c = a / b
message = "hello there!"
a = 5
b = 4
c = a / b
message = "hello there!"
a = 5
b = 4
c = a / b
message = "hello there!"
is_corgi = True
has_feet = True
has_tail = False
print(10 > 5)
print(10 < 5)
python comparisons.py
py.exe comparisons.py
print(10 > 5)
print(10 < 5)
print(10 > 5)
print(10 < 5)
print(10 > 5)
print(10 < 5)
# is 4.0 less than 4?
print(4.0 < 4)
# is 2 + 2 less than 5?
print(2 + 2 < 5)
# is 2 times zero greater than 1?
print(2 * 0 > 1)
print(2 + 2 == 5)
print(2 + 2 == 4)
print("cat" == "dog")
print("cat" == "cat")
python comparisons.py
py.exe comparisons.py
print(2 + 2 == 5)
print("cat" == "dog")
print(2 + 2 == 4)
print("cat" == "cat")
print(2 + 2 == 4)
print("cat" == "dog")
print("cat" == "cat")
# Store "5" in variable "a"
a = 5
# Give a True/False answer for
# whether "a" is equal to "5"
a == 5
print(1001 >= 1000)
print(1000 >= 1000)
print(999 >= 1000)
print(1001 <= 1000)
print(1000 <= 1000)
print(999 <= 1000)
a = 5
b = 3
print(a > b)
print(a < b)
print(a >= b)
print(a <= b)
print(a == b)
value = 4
if value == 4:
print("value is 4!")
else:
print("value is NOT 4!")
value = 4
if value == 4:
print("value is 4!")
else:
print("value is NOT 4!")
value = 4
if value == 4:
print("value is 4!")
value = 2
if value == 4:
print("value is 4!")
print("yay!")
value = 2
if value == 4:
print("value is 4!")
print("yay!")
value = 4
if value > 10:
print("value is over 10")
else:
print("value is equal to 10 or less")
python conditionals.py
py.exe conditionals.py
"value is equal to 10 or less"
age = raw_input('Enter your age:')
print("You are this age:")
print(age)
age = input('Enter your age:')
print("You are this age:")
print(age)
python --version
py.exe --version
python3 --version
python3 some_file_name.py
name = raw_input("Enter your name:")
print("Hello")
print(name)
name = input("Enter your name:")
print("Hello")
print(name)
python3 input.py
py.exe input.py
python input.py
# Python 2
species = raw_input('What species are you?')
# Python 3
species = input('What species are you?')
# Both Python 2 & 3
if species == "human":
print("Hallo human!")
else:
print("Hallo other being!")
python3 input.py
py.exe input.py
python input.py
# Python 2
number_one = raw_input("Enter a number: ")
number_two = raw_input("Enter another number: ")
# Python 3
number_one = input("Enter a number: ")
number_two = input("Enter another number: ")
# Both Python 2 & 3
print("The sum of both numbers:")
print(number_one + number_two)
# Python 2
number_one = raw_input("Enter a number: ")
number_two = raw_input("Enter another number: ")
# Python 3
number_one = input("Enter a number: ")
number_two = input("Enter another number: ")
# Both Python 2 & 3
print("The sum of both numbers:")
print(int(number_one) + int(number_two))
stackoverflow.com
Running into errors while programming you can't figure out? The answer is probably here.
An invaluable resource for coders.
learnpython.org
Free, interactive, online teaching material to get more in-depth in Python.
edx.org/course/cs50s-introduction-computer-science-harvardx-cs50x
Free introduction to computer science course from Harvard. Getting a certificate costs $90.
learn.freecodecamp.org
Free online courses to learn web development basics.
leap.ycombinator.com
Community by & for women in tech, with a focus on startups.
startupschool.org
Free videos and material to teach how to start a startup. You can audit courses.
Deadline is August 13th.
Text
news.ycombinator.com
source: https://www.digitalocean.com/currents/june-2018/
get slides here:
goo.gl/KWWMT
my website:
maelys.bio
3
100
123456
333
# Open the file.
with open("numbers.txt") as number_file:
# Read each line in the file.
for line in number_file:
# Multiply number by 3.
result = int(line) * 3
print(result)
python3 files.py
py.exe files.py
python files.py
# Open the file.
with open("numbers.txt") as number_file:
# Open the file.
with open("numbers.txt") as number_file:
# Open the file.
with open("numbers.txt") as number_file:
# Read each line in the file.
for line in number_file:
# Read each line in the file.
for line in number_file:
# Multiply number by 3.
result = int(line) * 3
print(result)
the flag is red
the door is green
the jar is transparent
with open("text.txt") as number_file:
for line in number_file:
if "green" in line:
print("This is green.")
else:
print("This is not green.")
python3 files.py
py.exe files.py
python files.py
with open("text.txt") as number_file:
for line in number_file:
if "green" in line:
print("This is green.")
else:
print("This is not green.")
name = "Maya Angelou"
length_of_name = len(name)
print(length_of_name)