CIS 2020 · Python for Everyone · Module 1 · Study guide
This covers the first five sections of Chapter 1, from what a program is to reading your first Python file line by line. It is short on purpose. If something here is new to you, go back to that section in the book before the quiz.
A computer does nothing on its own. A program is what puts it to work.
A program is a list of very simple instructions, together with the data those instructions act on. The computer follows the list exactly and very quickly. The same machine can play music, show a web page, or add up a column of numbers, because each of those jobs is a different program loaded into the same hardware.
Three words the quiz expects you to keep straight:
You do not need to be an engineer, but you should know the main parts and what each one is for.
To run a program, the computer first copies it from secondary storage into memory, and then the CPU works through it step by step.
Where Python came from, and what "high level" means.
Python was written by Guido van Rossum and first released in 1991. The name comes from the British comedy group Monty Python, not the snake.
Python is a high level language. You write instructions that read a little like English and ordinary math, and a separate program called the interpreter turns them into the tiny steps the CPU understands. You never have to write CPU instructions yourself.
Python is clean and quick to read, which is why it is a common first language. It is not a teaching toy. It is used every day for data analysis, science, web servers, and automation. In this course we use Python 3.
Where your code lives and how you run it.
You write a Python program as plain text in an editor and save it in a file whose name ends in .py. The text you write is called the source code.
Most people work in an IDE, an integrated development environment, which puts the editor, a way to run the program, and tools for finding mistakes in one window. When your program produces text, it appears in a panel called the console or terminal.
Two habits the book pushes from the first day: back up your work often, and keep backup copies of earlier versions. A lost file is a lost afternoon.
The traditional first program prints one line of text. Every word of it is worth naming.
print("Hello, World!")
print is a function, a named operation that is already built into Python."Hello, World!" is a string, which is just text inside quotation marks. It is the argument here.A few rules that show up on the quiz:
print() with nothing in the parentheses prints an empty line.print("Total:", 42)..py file. Output appears in the console.print is a function. A string is text in quotes. The value you pass to a function is an argument.