Unit 1 - Program Basics Flashcards
*
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.
+
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.
.capitalize()
The .capitalize() method will convert the first character of the string to an uppercase with all of the other characters to a lowercase.
.index()
The .index() method can find the location of a character or a string within another string.
.lower()
The .lower() method will convert all of the characters of a string to lowercase including the first character.
.swapcase()
The .swapcase() method returns a copy of the string with the uppercase characters converted to lowercase and the lowercase characters converted to uppercase.
.title()
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.
.upper()
The .upper() method is the opposite of the .lower() method and converts all of the characters of a string to uppercase.
=
The = operator (equal sign) is an assignment operator that is used to assign values to variables.
Algorithm
A logical step-by-step plan that we need to build for solving a problem.
Argument
An argument is an actual value(s) that is being passed into the function when it is being called.
Base 10 Numbers
Also called decimal values, these are numbers using 10 digits that go from 0 to 9.
Base 16 Numbers
Also called hexadecimal numbers, these are any numbers using 10 digits (0 to 9) and 6 letters (A, B, C, D, E, and F).
Base 2 Numbers
Also called binary numbers, these are numbers using two digits, 0 or 1.
Base 8 Numbers
Also called octal numbers, these are numbers using 8 digits, going from 0 to 7.
Bool
A boolean data type consisting of a value of either True or False.
Boolean Expression
A boolean expression is an expression whose value is either true or false.
Boolean Operators
Boolean operators (also known as logical operators) allow us to build and combine more complex boolean expressions from more basic expressions.
Bytecode
An intermediary step for code conversion between the programming language that you write and the machine code that a computer uses.
Camel Case
Combining words where each word except the first word will start with a capital letter.
Casting (or Type-Casting)
Casting is when you convert a variable’s value from one data type to another.
Chained Conditional
A chained conditional is a conditional statement with a series of alternative branches.
Comments
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.
Comparison Operator
A comparison operator is one of a group of operators that compares two values. These include ==, !=, >, <, >=, and <=.