Introduction to Functions and Python Syntax
Welcome to StreetCode Academy’s Intro to Code class! We are delighted to have you be part of the StreetCode community and are looking to grow with you throughout the quarter.
Today’s class slides can be found below:
Functions and Python Syntax
Functions – combined lines of code that accomplish a specific task.
def hello():
print("Hello World")
hello()
Rules for naming functions:
- Function names must start with a letter or underscore (‘_’)
- They can only contain the following characters: a-zA-z0-9_
- They must end in open and closed parenthesis: ‘(‘ and ‘)’
- They cannot be a Python keyword. Here is a list of Python Keywords.
print – is a handy tool that will allow you to write things to the console so you can get visibility to what the code is doing
console – a white board where your code can write to.
(ELW1.1) Extended Learning Opportunity 1: Draw a Panda
After your first week of class, you can use the extended learning opportunities as ways to practice outside of class.
(ELW1.2) Extended Learning Opportunity 2: Code Fixer
This extended learning opportunity, there are parts of the code that aren ‘t working. Use your knowledge of python syntax and functions to get them working again!
Week 1 Review and Walkthrough of Draw A Panda
Extra Learning Opportunities
Throughout all iterations of Intro to Code, we have always started with Reeborg. Reeborg is a tool to help us understand functions even better. I would suggest clicking on the following links below to get acquainted with Reeborg to help you explore functions even better!