程序代写代做代考 python data structure interpreter file system algorithm ISYS90088

ISYS90088
Introduction to Application
Development

School of Computing and Information Systems
University of Melbourne

Semester 2 , 2018

Dr Antonette Mendoza

* Some slides are adapted from Fundamentals of Python by Kenneth A. Lambert and dept. resources

Lecture Agenda

l  Introduction
l  Objectives

l  Staff ; Learning & Assessment
l  What is a computer, and how do we talk to it?

l  Python

l  Grok
l  Python Basics – print, input, strings

ISYS90088 sem 2 2018

1-2

About me (Antonette)

l  PhD in Computer Science – UoM
l  17 years @ UoM teaching

l  Three Dept. and MSE Teaching Awards
l  University of Melbourne Edward Brown Teaching Award (2017)

l  Australian Award for University Teaching award (2017)

l  Computing Research and Education (CORE) teaching award (2018)
l  Coordinator – Tutor development Program in the MSE; New

academic teaching development program in MSE; Graduate research
coordinator in CIS

3 ISYS90088 sem 2 2018

About me (Antonette)

l  Research focus:
Ø  Expertise lies in the area of process modelling, design and development of emerging

technologies that support positive computing, adoption and longer-term use.
Ø  Interests extend to exploring the impact of wider range of technologies that include

mobile applications and social media platforms on society including health care, e-
learning and telework. 

l  Grants:
Ø  Australian Research Council grant 2016 – 2018

Ø  “Catering for individuals’ emotions in technology development”

Ø  CRC Low Carbon Living grant 2014 – 2017
Ø  Increasing knowledge and motivating collaborative action on low carbon living through team-based and game-based

mobile learning’.

Ø  Other grants include: Learning and teaching grant 2015-2016; predictive tool for
depression care NHMRC grant 2014 – 2015; aged care touch frame project;
VVP project for industry client;

Ø  iPad app for assessment and feedback “Rapid Feedback” on iTunes in 2016.
ISYS90088 sem 2 2018 4

About me (Antonette)

Contact details:

l  Office: Room 6.03 Doug McDonnell Building
l  Email: mendozaa@unimelb.edu.au

l  Consultation: By appointment ( email me and I will give you a
time to meet)

ISYS90088 sem 2 2018 1-5

Setting Expectations

What is Programming?

What is a Software development life cycle?

Is it important?

What do you expect to learn from this subject?

ISYS90088 sem 2 2018 6

What we will be studying

l  Fundamental concepts and models of application development

l  Students who have no background in application development or
programming.

l  Learn about the software development lifecycle, program design,
data structures, problem solving, programming logic,
implementation considerations, testing and enterprise level
applications.

ISYS90088 sem 2 2018 1-7

Objectives
l  Learn to use primitive data types and data structures

l  Understand basic programming concepts

l  Write simple applications that relate to a specific domain

l  Design, implement, test, and debug a program that uses each of the

following fundamental programming constructs: basic computation,
simple I/O, standard conditional and iterative structures, and the
definition of functions.

l  Test applications

ISYS90088 sem 2 2018 1-8

Learning and Assessment
l  Lectures, Labs

l  Assessment

l  Textbook & references

ISYS90088 sem 2 2018 1-9

Learning and Assessment
Lectures: Tuesday 2.15pm – 4.15pm in Redmond Barry (Lyle Theatre)
Labs: 8 scheduled labs across the week – attend any one!

Workshop 1 Tuesday 18:15 20:15 Alan Gilbert-111

Workshop 2 Wednesday 17:15 19:15 Alan Gilbert-111

Workshop 3 Wednesday 19:15 21:15 Alan Gilbert-111

Workshop 4 Wednesday 16:15 18:15 Engineering B-102

Workshop 5 Thursday 19:15 21:15 Alan Gilbert-111
Workshop 6 Thursday 17:15 19:15 Elec. Engineering-121

Workshop 7 Thursday 16:15 18:15 PAR-Engineering B-102

Workshop 8 Friday 17:15 19:15 PAR-Alan Gilbert-111

ISYS90088 sem 2 2018 1-10

Learning and Assessment
Tentative Schedule: 

l  Week 01: Introduction

l  No workshops in week 01

l  Week02: Software development, data types and expressions
l  Worksheet 1 – simple print and input stmt + how to work with grok + idle download

l  Week03: math function + Conditions – for /while/if statement

l  Worksheet 2 – data types, expressions

l  Week04: Strings/sequences + math functions + Release ass 1 (10%)

l  Worksheet 3 – related to if/for/while statement

ISYS90088 sem 2 2018 1-11

Learning and Assessment
Tentative Schedule: 

l  Week05: complete sequences+ Functions

l  Worksheet 4 – sequences and conditions + assignment 1

l  Week06: Complete Functions – submit assignment 1
l  Worksheet 5 – functions & ass 1

l  Week07: Mid-semester test (10%)

l  Worksheet 6 – Review so far!

l  Week08: Iteration – for loops + while

l  Worksheet 7 – iteration

ISYS90088 sem 2 2018 1-12

Learning and Assessment
Tentative Schedule: 

l  Week09: complete + lists _ release assignment 2 (20%)

l  Worksheet 8 – feedback mid semester test + work on assignment 2

l  Week10: lists/dictionary
l  Worksheet 9 – list/dictionary + assignment 2

l  Week11: advanced functions & File I/O – submit assignment 2

l  Worksheet 10 – advanced functions

 
l  Week12: Any outstanding + exam revision (60%)

l  Worksheet 11 – practice questions and/or catch-up

 

 

ISYS90088 sem 2 2018 1-13

Learning and Assessment
Assessment:

l  Individual Assignment 1 (10%) due in Week 6
l  One mid-semester test (10%) in Week 7

l  Individual Assignment 2 (20%) due in Week 11
•  Exam (60%) – end of semester (3hr and will be a hurdle)

ISYS90088 sem 2 2018 1-14

Learning and Assessment
Text books/references:

l  You may use any text book and references.
l  Some books/references:

Ø  Fundamentals of Python – Kenneth A. Lambert
Ø  There are good online resources (free)

Ø  Check out: www.python.org

ISYS90088 sem 2 2018 1-15

LMS

l  University’s “Learning Management System”

l  http://www.lms.unimelb.edu.au/

l  Use your university email id and password

ISYS90088 sem 2 2018 1-16

A word about the LMS & other
environments

l  We will post all code from lectures (other than snippets
from the console”) on the LMS after each lecture;

Ø  It is a good idea to look back over the code to ensure you fully

understand it and play around with it yourself
Ø  Make sure to attend Tutorials and labs

l  You will work on GROK environment for your labs and
assignments

ISYS90088 sem 2 2018 1-17

Academic Honesty

Ø  In accordance with the University’s Academic Honest
and Plagiarism Policy (which you should familiarize
yourself with!):

https://academichonesty.unimelb.edu.au/

Ø  All examinable work (GROK worksheet answers and all
project work) that you submit for this subject must be
your own!!

ISYS90088 sem 2 2018 1-18

Academic Honesty

Ø  Common causes of breaches in the past have been:
ü  friends asking to look over your code to “get hints” for their

own project

ü  flatmates accessing your code via a shared desktop computer with
saved login details

ü  study groups where the facilitator has overstepped the line and
provided sample code to help people along

ISYS90088 sem 2 2018 1-19

Academic Honesty

Ø  Common attempts to escape undetected are:
ü  changing the comments but not the code

ü  changing variable names
ü  rearranging blocks of code (sometimes breaking the logic in the

process!)

Ø  It is all too easy to automatically pick up on all of these, and many,
many more, approaches using software plagiarism detection
software … and we do check

ISYS90088 sem 2 2018 1-20

So what is appropriate?

Ø  You are encouraged to share/collaborate directly on code for any
non-examinable items (notably the worksheets questions) … and you
will learn a lot from reading the code of others (including the sample
solutions in the worksheets)

Ø  You are very welcome to discuss with fellow classmates your approach

to worksheet questions and the projects, in conceptual terms, or in
terms of key data types or programming constructs used (just not with
the aid of raw code)

ISYS90088 sem 2 2018 1-21

Break!!!!

Lecture Objectives
After completing this lecture, you will be able to:

l  Describe the basic features of an algorithm

l  Explain how hardware and software collaborate in a computer’s
architecture

l  Compose and run a simple Python program

ISYS90088 sem 2 2018 23

Algorithms & Information Processing

Ø  Computer science focuses on

l  Algorithms

l  Information processing

ISYS90088 sem 2 2018 24

Algorithm – what is it?
Ø  Sequence of steps that describes each of these computational

processes is called an algorithm

Ø  Features of an algorithm:

l  Consists of a finite number of instructions
l  Each individual instruction is well defined

l  Describes a process that eventually halts after arriving at a solution
to a problem

l  Solves a general class of problems

ISYS90088 sem 2 2018 25

Algorithm – example!
l  Steps for making a cup of coffee !!!

Ø  Imagine that you want a robot (or a friend) to make it.

Ø  How will you explain this procedure to the robot (or your friend) so
they can make it?

ISYS90088 sem 2 2018 26

Algorithm – another example!
Ø  Steps for subtracting two numbers:

l  Step 1: Write down the numbers, with larger number above smaller
one, digits column-aligned from right

l  Step 2: Start with rightmost column of digits and work your way
left through the various columns

l  Step 3: Write down difference between the digits in the current
column of digits, borrowing a 1 from the top number’s next column
to the left if necessary

l  Step 4: If there is no next column to the left, stop

l  Otherwise, move to column to the left; go to Step 3
Ø  The computing agent is a human being

ISYS90088 sem 2 2018 27

Information Processing
Ø  Information is also commonly referred to as data

Ø  Data needs to be organized and stored in some form to be relevant
and easily accessed!

Ø  In carrying out the instructions of an algorithm, computing agent
manipulates information

l  Start with input à do something/task à produce output

ISYS90088 sem 2 2018

28

Structure of a Modern Computer System
Ø  A modern computer system consists of hardware and software

l  Hardware: physical devices required to execute algorithms

l  Software: set of these algorithms, represented as programs in
particular programming languages

ISYS90088 sem 2 2018 29

Computer Hardware

ISYS90088 sem 2 2018 30

Computer Hardware (continued)

Ø  Random access memory (RAM) is also called internal or
primary

Ø  External or secondary memory example: cd; floppies
magnetic disks; optical disks!!!

ISYS90088 sem 2 2018 31

Computer Software
Ø  A program stored in computer memory must be represented in binary

digits, or machine code

Ø  A loader takes a set of machine language instructions as input and loads
them into the appropriate memory location

Ø  The most important example of system software is a computer’s
operating system

o  Some important parts: file system, user interfaces (terminal-based or
GUIs)

Ø  Applications include Web browsers, games, etc.
ISYS90088 sem 2 2018 32

Computer Software (continued)

ISYS90088 sem 2 2018 33

Getting Started with Python
Programming

Ø  Early 1990s: Guido van Rossum
l  invented the Python programming language

Ø  Python is a high-level, general-purpose programming language for

solving problems on modern computer systems

Ø  Useful resources at www.python.org

ISYS90088 sem 2 2018 34

Running Code in the Interactive Shell

Ø  Python is an interpreted language
Ø  Simple Python expressions and statements can be run in the shell

l  Easiest way to open a Python shell is to launch the IDLE

(Integrated DeveLopment Environment)

l  To quit, select the window’s close box
l  Shell or command line is useful for:

l  Experimenting with short expressions or statements
l  Consulting the documentation

ISYS90088 sem 2 2018 35

Running Code in the Interactive Shell
(continued)

ISYS90088 sem 2 2018 36

Input, Print, String Processing & Output

Ø  Programs usually accept inputs from a source, process them, and

output results to a destination
l  In terminal-based interactive programs, these are the keyboard and

terminal display

ISYS90088 sem 2 2018 37

The print statement

A print statement evaluates the expression and displays them, separated
by one space, in the console window

l  Syntax:

print (, …, )
Example:

>>>print (3)
3

l  If you want to display a text (in python called a string), then the

string must be enclosed within quotations – single or double

ISYS90088 sem 2 2018 38

Strings in python

l  The word string is used to describe a piece of text inside quotes.
l  You’ve seen how Python can be used to manipulate numbers, but it

is also useful to be able to manipulate text.

l  The things you type into a Python program are expected to be
Python commands.

Example:

>>>print (“hi there”)
>>>print (‘hi there’)

>>>print (“what’s she doing”)

Lets run this and see what happens!!!!!
ISYS90088 sem 2 2018 1-39

Strings in python

l  Suppose you want to represent the words Hello There as text inside
a Python program. If you type them as is into the program directly,
Python will try to treat those words as names in the Python
language:

>>> print (hello there)

What happens? Lets check it out!

We get an error message!!!!!

ISYS90088 sem 2 2018 1-40

Errors and python translator

l  Sometimes, you will write something which the Python interpreter
does not understand. The most basic kind of mistake you can make
is a syntax error.

l  A syntax error occurs when you type something which is not
properly formed, according to the rules of the programming
language.

l  It is the same as a grammatical error in English (or any natural
language for that matter).

l  So, in this example it did not know what hello there is (not an
identifier) until you tell it to be a string within quotes.

>>> print (‘hello there’)
hello there

ISYS90088 sem 2 2018 1-41

print – examples

ISYS90088 sem 2 2018 1-42

•  You can type in expressions and it will calculate the answer for
you (noting that the asterisk, or *, signifies multiplication):

>>>print (3 * 2)
6

 

The input statement

ISYS90088 sem 2 2018 43

•  Python has a built-in function called input that can be used to get
keyboard input from the user as a string.

•  The input function can be given a message to display, usually

prompting the user with what kind of information the program wants.

•  A variable is a name for a value. When a variable receives a value, that
value can be accessed using the variable name when required.

The input statement – example

ISYS90088 sem 2 2018 44

Variables and the Assignment Statement
l  A variable associates a name with a value

Ø  Makes it easy to remember and use later in program
l  Variable naming rules:

Ø  Reserved words cannot be used as variable names

l  Examples: if, for, while and import

Ø  Name must begin with a letter or underscore _

l  The rest of the name can contain zero or more occurrences of the following things:
Ø  Digits (0 to 9) .

Ø  Alphabetic letters.

Ø  Underscores.

§  Names are case sensitive

Ø  Example: WEIGHT is different from weight
Tip: use “camel casing” (Example: interestRate)

45

Variables and the Assignment
Statement (continued)
l  Nothing else is allowed in a variable name. Here is (incomplete) list of the things you

can’t use anywhere in a variable name:

Ø  Whitespace characters (the space, tab, new line).
Ø  Hyphens (-)

Ø  Quotation marks (single or double)

Ø  Symbol characters such as: the question mark, the exclamation mark, brackets,
and so forth.

l  The following words having special meaning in Python (reserve words), and so they
cannot be used for variable

Examples:  
def, if, for, while, else, except, return, True,  range, list, continue

46

Variables and the Assignment Statement
(continued)

l  Programmers use all uppercase letters for symbolic constants

Ø  Examples: TAX_RATE and STANDARD_DEDUCTION

l  Variables receive initial values and can be reset to new values with an assignment
statement

=
Ø  Subsequent uses of the variable name in expressions are known as variable

references

47

Variables : Example 1
#Which of the following are valid variable names?

a.  length

b.  _width

c.  firstWord

d.  2MoreToGo
e.  halt!

Solution: ????

48

Editing, Saving, and Running a Script
Ø  We can then run Python program files or scripts within

IDLE or from the OS’s command prompt

Ø  Python program files use .py extension

Ø  Running a script from IDLE allows you to construct some
complex programs, test them, and save them in program
libraries to reuse or share with others

ISYS90088 sem 2 2018 49

Editing, Saving, and Running a Script
Ø  Select New File from the File menu
Ø  enter the python code/statements

Ø  File/Save as (give a sensible name to your file. The extension will
be.py)

Ø  To run the file or code as a python script, select Run module from
the Run Menu

Examples using IDLE – shown in lecture

ISYS90088 sem 2 2018 50

Editing, Saving, and Running a Script
(continued)

ISYS90088 sem 2 2018 51

Editing, Saving, and Running a Script
(continued)

ISYS90088 sem 2 2018 52

Behind the Scenes: How Python Works

ISYS90088 sem 2 2018 53

Detecting and Correcting Syntax
Errors

Ø  Programmers inevitably make typographical errors when
editing programs, called syntax errors

l  The Python interpreter will usually detect these

Ø  Syntax: rules for forming sentences in a language

Ø  When Python encounters a syntax error in a program, it
halts execution with an error message

ISYS90088 sem 2 2018 54

Detecting and Correcting Syntax
Errors (continued)

ISYS90088 sem 2 2018 55

Install Python

l  We will use Python v3.4 via GROK (on my machine 3.5.1)
l  You just write it like a text and the python interpreter turns it into

machine code for you

l  Get a copy of python for your own machine at home – there are free
versions for Windows, MacOS and Linux

http://www.python.org/download/

l  Portable version (USB) http://portablepython.com/
l  Advanced Python Distribution (for scientific experimentation)

http://www.enthought.com/products/edudownload.php

ISYS90088 sem 2 2018 1-56

Grok Learning environment

l  GROK Learning is the web-based programming
environment we will be using for the duration of this
subject in your labs:
https://groklearning.com/course/unimelb-isys90088-2018-s2/

l  All you need to access the system is a browser, an internet
connection and your GROK account

l  Different modes of working in GROK: code, run, mark,
terminal

ISYS90088 sem 2 2018 1-57

Summary
Ø  Fundamental ideas of computer science

l  The algorithm

l  Information processing

Ø  Real computing agents can be constructed out of
hardware devices

l  CPU, memory, and input and output devices

ISYS90088 sem 2 2018 58

Summary (continued)
Ø  Software provides the means whereby different algorithms

can be run on a general-purpose hardware device

l  Written in programming languages

Ø  Languages such as Python are high-level

Ø  Interpreter translates a Python program to a lower-level
form that can be executed on a real computer

Ø  Python shell provides a command prompt for evaluating
and viewing the results of Python expressions and
statements

ISYS90088 sem 2 2018 59

Summary (continued)
Ø  IDLE is an integrated development environment that allows

the programmer to save programs in files and load them
into a shell for testing

Ø  Python scripts are programs that are saved in files and run
from a terminal command prompt

Ø  When a Python program is executed, it is translated into
byte code
l  Sent to PVM for further interpretation and execution

Ø  Syntax: set of rules for forming correct expressions and
statements in a programming language

ISYS90088 sem 2 2018 60

Leave a Reply

Your email address will not be published. Required fields are marked *