110 likes | 572 Views
COMP 102: Computers and Computing. Programming with Python 3. Mike Hallett, www.bci.mcgill.ca michael.t.hallett@mcgill.ca. Python 3.x. Lecture 8. Computer program: A list of instructions that tell a computer what to do in order to achieve some predefined task.
E N D
COMP 102: Computers and Computing Programming with Python 3 Mike Hallett, www.bci.mcgill.ca michael.t.hallett@mcgill.ca Python 3.x Lecture 8
Computer program: A list of instructions that tell a computer what to do in order to achieve some predefined task. Computer language: A formal constructed language for expressing computer programs. Computer programming: The art and science of writing programs in a specific programming language.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. This is an example of machine language. It is one step away from the binary 0/1 logical circuits that a computer is made of. The numbers are in hexadecimal (base 16)… for reasons you’ll soon understand.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. Assembler Code: One step away from machine language. Very simple code.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. Fortran, one of the first high level languages for scientific computing.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. C, the lowest of the high level languages.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. R, an interpreted language for statistics.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. Java, an object oriented high level language.
There are many computer languages. From very “high level” to very “low level”. With many different mandates. Scratch was made for children to program simple graphical games.
Python, the programming language https://www.python.org/ A beginner’s guide to programming (with Python) https://www.python.org/about/gettingstarted/ Interactive Development Environment (IDE) Thonny (Python 3.5 comes with it) http://thonny.cs.ut.ee/ An alternative IDE: PyScripter http://code.google.com/p/pyscripter If you really really can’t get Python installed on your machine, use: https://www.python.org/shell/ A tutorial/textbook for beginners with Python. http://openbookproject.net/thinkcs/python/english3e/
Take home messages • Lots of programming languages • Python’s been around for a while, pretty popular, many internet apps written in it • IDEs • Use Python version 3.x • Read Chapters 1 and 2 Actionable Items • Write a program that ask the user for their first name, middle initial and last name, and prints them out in the format • Hallett, Michael T • Define three variables x, y, and z and assign three (arbitrary) • integers to them. For example, x = 1, y= 2 and z = 3. • Write a program to make a “three-way swap” so that afterwards y has the value that initially in x, z has the value • from y, and x has the value from z.