1. Program: consists of instructions executing one at a time. Basic
instruction types are:
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.
2. algorithm: A sequence of instructions that solves a problem
3. Python Interpreter: a computer program that executes code written in
the Python programming language
4. Interactive interpreter: a program that allows the user to execute one
line of code at a time.
5. Code: a common word for the textual representation of a program (and
hence programming is also called coding). A line is a row of text.
,6. Statement: is a program instruction. A program mostly consists of a
series of statements, and each statement usually appears on its own line.
7. 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.
8. New Variable: is created by performing an assignment using the =
symbol, such
as salary = wage * hours * weeks, which creates a new variable called salary.
9. print() function: displays variables or expression values.
10. string literal: Text enclosed in quotes is known as
11. end=' ': inside of print() to keep the output of a subsequent print
statement on
the same line separated by a single space.
12. newline character: Output can be moved to the next line by printing "\
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. "\n" consists of two characters, \ and n, but together are
considered
by the Python interpreter as a single character.
,13. whitespace: Any space, tab, or newline
14. input(): Reading input is achieved using. The statement best friend =
input()
will read text entered by the user and the best friend variable is assigned
with the
entered text. The function input() causes the interpreter to wait until the user
has
entered text and pushed the return key.
15. string: The input obtained by input() is any text that a user typed,
including
numbers, letters, or special characters such as # or @. Such text in a
computer
program is called
16. 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
determines how
a value can behave
17. int(): Reading from input always results in a string type. However, often
a
, programmer wants to read in an integer, and then use that number in a
calculation. If
a string contains only numbers, like '123', then the... function can be used to
convert
that string to the integer 123.
18. Syntax error: violates a programming language's rules on how symbols
can be
combined to create a program. An example is putting multiple prints on the
same
line.
19. runtime error: in which a program's syntax is correct but the program
attempts
an impossible operation, such as dividing by zero or multiplying strings
together (like
'Hello' * 'ABC').
20. Common Errors: Indentation Error - The lines of the program are not
properly
indented.
Value Error - An invalid value is used, which can occur if giving letters to int().
Name Error - The program tries to use a variable that does not exist.
Type Error - An operation uses incorrect types, which can occur if adding an
integer
to a string.
21. logic error: Some errors may be subtle enough to silently misbehave,
instead
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller BESTNURSING. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.99. You're not tied to anything after your purchase.