Unit 1 - Program Basics Flashcards

1
Q

*

A

The * operator (asterisk sign) or multiplication operator is unique to Python as it can multiply integers and can also be used as a replication operator with strings and integers (floats will not work). As a replication operator, it will repeat (make a copy of) the variable based on the number of times it is multiplied by.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

+

A

The + operator (plus sign) is the addition operator on integers; however, it can also function as a concatenation operator when applied to string variables, which means it joins the variables by linking them end to end. An error will appear if trying to use this operator on variables that are a mix of string and integer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

.capitalize()

A

The .capitalize() method will convert the first character of the string to an uppercase with all of the other characters to a lowercase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.index()

A

The .index() method can find the location of a character or a string within another string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

.lower()

A

The .lower() method will convert all of the characters of a string to lowercase including the first character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

.swapcase()

A

The .swapcase() method returns a copy of the string with the uppercase characters converted to lowercase and the lowercase characters converted to uppercase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

.title()

A

The .title() method returns a copy of the string where the first letter of each word is converted to uppercase with the other characters converted to lowercase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

.upper()

A

The .upper() method is the opposite of the .lower() method and converts all of the characters of a string to uppercase.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

=

A

The = operator (equal sign) is an assignment operator that is used to assign values to variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Algorithm

A

A logical step-by-step plan that we need to build for solving a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Argument

A

An argument is an actual value(s) that is being passed into the function when it is being called.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Base 10 Numbers

A

Also called decimal values, these are numbers using 10 digits that go from 0 to 9.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Base 16 Numbers

A

Also called hexadecimal numbers, these are any numbers using 10 digits (0 to 9) and 6 letters (A, B, C, D, E, and F).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Base 2 Numbers

A

Also called binary numbers, these are numbers using two digits, 0 or 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Base 8 Numbers

A

Also called octal numbers, these are numbers using 8 digits, going from 0 to 7.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Bool

A

A boolean data type consisting of a value of either True or False.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Boolean Expression

A

A boolean expression is an expression whose value is either true or false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Boolean Operators

A

Boolean operators (also known as logical operators) allow us to build and combine more complex boolean expressions from more basic expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Bytecode

A

An intermediary step for code conversion between the programming language that you write and the machine code that a computer uses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Camel Case

A

Combining words where each word except the first word will start with a capital letter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Casting (or Type-Casting)

A

Casting is when you convert a variable’s value from one data type to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Chained Conditional

A

A chained conditional is a conditional statement with a series of alternative branches.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Comments

A

The “#” (hashtag) is used in Python code to identify a comment. Commented lines of code are ignored by the compiler during run time. A programmer adds comments throughout the code to explain how the program or function works.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Comparison Operator

A

A comparison operator is one of a group of operators that compares two values. These include ==, !=, >, <, >=, and <=.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Compiler
A compiler scans an entire program and attempts to convert the whole program at once to machine code.
26
Complex
A numeric data type consisting of a number that is the sum of a real number and an imaginary number.
27
Compound Statement
A statement that consists of a header line that ends with the colon character (:) followed by an indented block. It is called compound since it stretches across more than one line.
28
Concatenation
The operation of joining or merging two or more strings together.
29
Condition
A condition is a boolean expression in a conditional statement that determines which branch is executed.
30
Conditional Statement
A conditional statement is a statement that controls the flow of execution depending on some condition.
31
Corner Case
The value you are testing is in between two edge cases.
32
Edge Case
Values that are at the end of a testing range.
33
Empty String
An empty string ('') is a string that is identified but does not contain anything; it is essentially empty.
34
Escape Character
Special characters that when added to a string will allow quotes of a string to be escaped.
35
Exceptions
Errors detected during execution (running of the code) are called exceptions.
36
Expression
A combination of values, variables, and operators.
37
Float
A numeric data type referring to a floating point number. It is a number that can be positive or negative and uses decimal values.
38
Functions
A function is a section of code that runs when it is called. We have the ability to pass in data into those functions, which are called parameters.
39
Input
Ways a program gets its data; user input through the keyboard, mouse, or other device.
40
Int
A numeric data type consisting of an integer or a whole number. It can either be a positive or a negative number but it does not have any decimals.
41
Integrated Development Environment (IDE)
A text editor that has additional functionality to allow developers to perform some additional tasks to simplify the workflow of the development process.
42
Interior Test
Test values that are within a specific range where the precise values that we entered within that range did not matter.
43
Interpreter
An interpreter takes the bytecode one line at a time and converts it to machine code.
44
Libraries/Library
Prewritten code collections that you can use when developing a program.
45
Literal String
A series of characters that are combined together and enclosed in quotes; for example, 'Enter in the second number' is a literal string.
46
Machine Code
Also known as machine language. The computer uses binary (0s and 1s) to perform tasks. At a high level, the programming language code that you write gets translated or compiled to the machine code that the computer understands.
47
Methods
Methods are a specialized type of procedure that’s directly associated with an object and called to perform a specific task by using the object name, a period, and then the method name.
48
Module
A self-contained piece of code that can be used in different programs.
49
Nested Conditional
A conditional statement that appears in one of the branches of another conditional statement.
50
Object
An object is an instance of a class that has properties and methods that are encapsulated or part of it.
51
Output
The results at the end of a program based on user input and system processing.
52
Parameter
A parameter is the actual variable name(s) when we define a function definition.
53
Pascal Case
Combining words where each word starts with a capital letter.
54
Processing
Taking the data inputs and prompts and calculates the results (output).
55
Program
A sequence of computer language statements that have been crafted to do something.
56
Pseudocode
English-like statements that describe the steps in a program or algorithm.
57
Short-Circuit Evaluation
Short-circuit evaluation is when the evaluation of a logical expression stops because the overall value is already known.
58
Snake Case
Combining words where each word is separated by an underscore and all of the words are in lowercase.
59
Statement
A unit of code that the Python interpreter can execute.
60
Str
A text data type consisting of characters that are enclosed in either single or double quotes.
61
String
A data type that can store a literal string as a value.
62
Syntax
The syntax is the “grammar” rules of the programming language. Each programming language (like Python) has its own syntax.
63
Syntax Error
A syntax error means that you have violated the “grammar” rules of Python.
64
Traceback
A traceback is a list of functions that are executed and printed to the screen when an exception occurs.
65
Truth Table
A truth table is a small table that lists every possible input value and gives results for the operators.
66
Value
One of the basic units of data, like a number or string, that a program manipulates.
67
Variable
A named memory location that has the ability to hold various distinct values at different points in time in the program.
68
Virtual Machine
A software program that behaves like a completely separate computer within an application.
69
and
The and operator is a reserved keyword and boolean operator that takes two arguments and returns a boolean value of False unless both inputs are True.
70
as
The as keyword is one of Python’s reserved keywords and simply is used to create an alias.
71
float()
The float() function can create a float number from an integer literal, float literal, or a string literal as long as the string has a float or an integer.
72
in
The in operator is a reserved keyword and used as a membership operator that checks if the first operand is contained in the second. If it is contained, it returns true; otherwise, it returns false. It can also be used to iterate through a sequence in a for loop.
73
int()
The int() function creates an integer number from an integer literal, a float literal (by removing all of the decimals), or a string literal (assuming the string represents a whole number).
74
len()
The len() function counts all characters, including punctuation and spaces.
75
not
The not operator is a reserved keyword and boolean operator that works with one argument and returns the opposite truth value of the argument.
76
or
The or operator is a reserved keyword and boolean operator that outputs True if either input is True (or both).
77
pass
A pass statement is a reserved keyword that is essentially a statement that will do nothing.
78
print()
The print() function allows Python to send data to the output screen.
79
str()
The str() function creates a string from various data types, including strings, integer literals, and float literals.
80
try and except
try and except are reserved keywords. The idea of the try and except statements is that you know that some sequence of instruction(s) may have a problem and you want to add some statements to be executed if an error occurs. These extra statements (the except block) are ignored if there is no error.
81
type()
The type() function takes a value or variable as input and returns the type of the value or variable.