1 of 14

Newton Girls Who Code

Tuesday Session 8, 12-11-2018

2 of 14

Welcome!

3 of 14

Plan for Today

  1. Reviewing Functions
  2. Spotlight: Women Who Code
  3. Programming Concepts: Classes/ Objects
  4. Break
  5. Work on your Project!
  6. Stand-up
  7. Chill time

4 of 14

Function review

  1. What is a function?
  2. What is the utility of a function?
  3. What is the general structure of a function?
  4. How do you call a function?

5 of 14

What is a function?

# Let's define a function.def function_name(argument_1, argument_2):� # Do whatever we want this function to do,# using argument_1 and argument_2��# Use function_name to call the function.�function_name(value_1, value_2)

6 of 14

Reviewing Functions

Begin by opening: https://www.python.org/shell/

Beginner: Write out a function that prints “Hi, my name is Ann” when you call the function name(Ann)

Intermediate: Write out a function that sums two numbers, so when you call sum_num(3,4) you get 7

Challenge: Write a function to determine if a number is prime. Should print “True” if prime and “False” if not (ex, is_prime(5) should return True)

7 of 14

Spotlight: Women Who Code

Arlene Garcia-Gunderson

Watch Video

  • What struggles do Deaf students face in the classroom? How can technology help overcome them?

  • How is Veditz different from other tutoring or educational platforms?

  • What personal factors and experiences influenced Arlene to become an education technology entrepreneur?

8 of 14

What is an Object?

Student

traits

- hair color

- age

Can do

- codes

- plays Violin

class Student

  • hairColor = ”black”
  • age = 15

�Methods or functions

- codes(language)

- playsViolin()

9 of 14

How to use objects in Python

class Student:

def __init__(self, name, age): //self - reference to the class

self.name = name

self.age = age

def code(language):

print("I code in " + language)

student = Student("Mary", 15)

//call method

student.code(“python”); // ----will print: I code in python

print(student.name)

print(student.age)

10 of 14

Python Syntax

Exercises:

https://www.w3schools.com/python/exercise.asp?filename=exercise_operators1

Resources:

https://www.tutorialspoint.com/python/python_basic_operators.htm

Classes

https://www.w3schools.com/python/python_classes.asp

Interactive

https://www.learnpython.org/en/Classes_and_Objects

11 of 14

Continue working on your projects!

12 of 14

Plan for Today

  • Spotlight: Women Who Code
  • Programming Concepts: Classes/ Objects
  • Break
  • Work on your Project!
  • Coding Time
  • Stand-up
  • Chill time

13 of 14

Stand-up

Start with your name, then choose from the following questions:

  • Suggest a specific skill in a language that you’d find useful to learn

  • Suggest something we could change to make sessions better

  • Let us know if you'd rather not have standups...

If you have an idea for next week’s lightning standup,

e-mail instructors@newtongwc.org and let us know

14 of 14

See you next week!