Lesson 1: Python Basics Flashcards
What are computers designed to do?
Fulfill our commands
What does communicating with a computer require?
It requires an individual to be able to speak their language, (become a programmer)
How does a computer “user” view computers?
As tools, Ex. word processor, map, note
How does a computer “programmer” utilize computers?
They harness computer’s “ways”
They have and use tools that allow them to build new tools
What impact do programmers have on society?
- They write tools for users
- They write personal “helpers” for efficiency, (to automate a task)
What is a program?
A sequence of stored instructions executing one at a time that shapes computer behavior
Why is coding important?
- It represents a fragment of our problem - solving skill
- It’s a means of sharing insights and discoveries with others
- Eliminates the need for others to reinvent the wheel
What are the 3 basic instruction types?
- Input
- Process
- Output
What is input?
The source through which a program obtains data. Such as touchscreens, keyboards, files, and networks
What is Process?
A program carries out calculations on the data.
Ex. adding two values such as x + y
What is Output?
Where a program stores processed data. Ex. file, screen, network
What is a compiled program?
Programs that undergo translation into machine code by the compiler before execution.
Ex. C++, Java
What is a benefit of compiled programs?
Faster execution speeds than interpreted programs
What is a limitation of compiled programs?
Restricted to running exclusively on the CPU for which they were compiled
What is an interpreted program?
Programs that undergo real time translation and execution by the interpreter.
What is a limitation of interpreted programs?
Slower execution speeds than compiled programs
What is an advantage of interpreted programs?
They are platform independent, which means that they can run seamlessly on any compatible system where the corresponding interpreter is present
Ex. Python, JavaScript
What are two ways to talk to Python that are used in this course?
- Interactive Python Interpreter on command line (windows) / terminal interface (mac)
- Direct execution of Python (.py) files
Which commands allow the current directory to be accessed via the command line / terminal?
pwd (mac) / cd (windows)
Which commands allows a list of all contents to be accessed via the command line / terminal?
ls (mac) / dir (windows)
Which commands allows navigation to one level up on command line / terminal?
cd
What is a syntax error?
An error that occurs when code violates a programming language’s rules for proper grammar.
What is a literal?
Fixed values such as numbers, letters, strings, and boolean values
Numeric Liteterals: Ex. 15, 9.5
String Literals: Can be enclosed in single quotes Ex. (‘Hello’) or double quotes (“Hello”)
Boolean literals - ‘True’, ‘False’
What is a variable?
A named place in the memory where a programmer can store data and later retrieve the data using a variable “name”