Documente Academic
Documente Profesional
Documente Cultură
Chapter 1.1-1.6
Photo from RCReptiles.com
Learning Outcomes
Machine
Source Code Machine Code
runs
(program) (executable)
Compiler
Machine
Inputs runs Outputs
Executable
C++ Example
#import <iostream.h>
Source Code
(program)
Computer
Program
runs
Outputs
Interpreter
User Inputs
Perl Example
Questions to discuss:
print(2 + 3)
print 2 + 3
print (2 + 3)
print(2+3)
print("2 + 3")
print("2+3")
print('2+3')
When the function is called, the sequence of statements in its definition are
executed.
Dissecting the function
Functions Recap
Python allows us to make our own commands, called
functions.
Another Example:
A slight variant
What did we change? What can we learn about the
print() function?
Customizing Functions: Recap
# program1.py
# Author: Grace Ngai
This is the
directory
(folder)
where my This is my program
program
lives.
Using Your Program