- We write computer programs to tell computers what to do.
- Every application you use is a computer program.
- We write programs using programming languages.
- In this class, we will learn the Python Programming Language.
- The field of computer science (what you study as a CS major) includes computer programing, but also:
- Problem solving
- Algorithms and computing theory
- Information organization and processing
- System design
- Human Interfaces
- Hardware systems (CPU, Disk Drives, Networks, etc.)
- Computers are more useful when they run on an operating system.
- Operating systems manage the underlying computer hardware and often provide a nice user interface
- Mac OS X
- Linux (UNIX)
- There are many other operating systems, but these are the most popular. Others include:
- iOS (iPhone OS), based on Mac OS X
- Android OS, based on Linux
- We will be learning the Linux operating system, as it is used to power most internet services and applications.
Working in Linux
- You may not be familiar with Linux, but it is pretty easy to learn.
- Just like Windows and Mac OS X, Linux provides a graphical user interface with windows and menus.
- Linux has standard applications like a web browser (Firefox or Chrome) and word processing (OpenOffice).
- As programmers, you need to learn how to use the Terminal and the UNIX command line interface.
- The command line allows you to type commands directly.
- From the command line you can look examine directories, edit files, and run programs.
- You can also do much more.
- Getting familiar with the command line will make you a better programmer.
- You will do all of your work for CS 110 using your CS account.
- This account allows you to login into all the CS machines.
- The machines are located in HR 235, HR 530, and HR 536.
- You can also login remote though stargate.cs.usfca.edu using ssh (more later).
Email Communication, Discussion Group, and Portfolios
- First, as a computer scientist, email communication is extremely important.
- We need to make sure that you can send email to the instructor and TAs and that you can receive all course related email.
- Email accounts. Currently you probably have the following email accounts:
- Your personal account (Gmail, Yahoo, Hotmail, etc.)
- Your Donsmail account
- Your CS account
- Wow, that's a lot of email accounts.
- You need to understand what each account is needed for and how to set them up so that your email goes to one place.
- You should pick one account (likely, your personal account or your new Gmail account), call this your MAIN account.
- You should have mail forwarded from your other accounts to your MAIN account.
- You need to email me your MAIN account, so that I know what it is.
- We will use a Google Group for course announcements and discussion.
- You need to read your email regularly for updates and help.
- You can ask questions to the group and the instructor or TA will respond.
- For this class you will maintain a CS 110 portfolio.
- We will be using Google Sites for you portfolio.
- You need to send me a link to your portfolio.
- All lab work and projects will be submitted to your portfolio.
Running Python Interactively
- We can use the Python programming language in two ways:
- Interactive mode
- Script mode (program mode)
- In interactive mode, you can type python code directly into the interpreter and get results:
Python 2.7.3 (default, Apr 24 2012, 00:00:54)
[GCC 4.7.0 20120414 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Creating Python Program Files
- As an alternative to using Python interactively, you can write python code and put it into a file.
- In order to write programs this way, we need to use an editor.
- A simple editor found on Linux is call Gedit.
- You can start gedit from the command line or from the Applications menu.
- You can also use the UNIX cat command to create simple files: