1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Input
A program receives data from a file, keyboard, touchscreen, network, etc.
Process
A program performs computations on that data, such as adding two values like x + y.
Output
A program puts that data somewhere, such as a file, screen, or network.
Algorithm
A sequence of instructions that solves a problem.
Python Interpreter
The Python interpreter is a computer program that executes code written in the Python programming language. An interactive interpreter is a program that allows the user to execute one line of code at a time.
Statement
A program mostly consists of a series of statements, and each statement usually appears on its own line.
Expressions
are code that return a value when evaluated; for example, the code wage hours weeks is an expression that computes a number. The symbol * is used for multiplication. The names wage, hours, weeks, and salary are variables, which are named references to values stored by the interpreter.
Assignment
A new variable is created by performing an assignment using the = symbol, such as salary = wage hours weeks, which creates a new variable called salary.
Newline Character
Output can be moved to the next line using the newline character "\n". Ex: print('1\n2\n3') prints "1" on the first line, "2" on the second line, and "3" on the third line of output.
Escape sequence
An escape sequence is a string that has a special meaning, like the newline character "\n", that always starts with a backslash "\". Other escape sequences exist, such as "\t" to insert a tab, or "\\" to print an actual backslash character.
input() function
The input() function is used to read input from a user. The statement best_friend = input() will read text entered by the user, and assign the result as a new string to the best_friend variable. The input() function causes the program to wait until the user has entered text and pushed the return key.
type
The string '123' (with quotes) is fundamentally different from the integer 123 (without quotes). The '123' string is a sequence of the characters '1', '2', and '3' arranged in a certain order, whereas 123 represents the integer value one-hundred twenty-three. Strings and integers are each an example of a type; a type determines how a value can behave. For example, integers can be divided by 2, but not strings (what sense would "Hello" / 2 make?). Types are discussed in detail later on