Looks like no one added any tags here yet for you.
+
add
-
Subtraction
*
multiplication
/
division
//
the quotient (sans decimal)
%
Remainder
**
To the power of
abs()
Absolute Value
min() and max()
min and max of a set of numbers
<
less than
>
greater than
==
equivalent too
!=
not equal too
<=
less than or equal to
>=
greater than or equal to
and
99% T and 1%F, then false
or
99% F and 1%T, then true
not()
negation of the inside of the bracket
Integers
Be represented exactly. There is no limits to their size (other than the size of you memory)
Floating points
approximation of real numbers.
What forces a float
division
what must one do after defining a function
tab in
general form for a function
def f(x):
what must you call to use pi or sqrt
import math
if a function has two variables listed how many does it need to exist
2
What is a library
Widely understood code (for example math) that is imported to make life easier
what does the print function do
ONLY outputs, can not use the function after printing
what does the return function do
outputs and allows you to use the answer in future code
what does the function \n do
prints a new line
how can you type words or expressions
print(‘ ‘)
What is a string
Custom texts using ‘ ‘ or “ “
What does Type do
Tells you the type of variable the function will return
what does a single \ do in a string
Over rides the special meaning of the following character.
How can you use an apostrophe in a string only using qoutes
“blah’s”
\n
Prints a new line
\t
prints a tab
\n\t
creates a new line with a tab space
Can you add two strings together
yes
Can you add an integer / float with a string
No
How do you type just a space using a string
“ “.
How do you get a space between two strings
use a comma to separate parameters
What does len do
returns the number of items in an object, such as a string or list.
Is a string a collection
Yes
\b
deletes pervious characterin a string or text.
When you type a=1 then a=6 what is the final value of a
The final value of a is 6, as the last assignment overwrites the previous one.
What does input do
Input allows the user to provide data to a program, typically via keyboard or other input devices.
What type of function does input take when you type
a string
What does int do
Int converts a value to an integer data type, allowing numerical operations on the value.
What does float do
Float converts a value to a floating-point data type, enabling calculations with decimal numbers.
What does ‘in’ do
Finds if a string is a subset of another set
What does “not in”
Finds if a string does not have the subset listed
What does str do
Converts a value to a string data type, allowing for the representation of non-string values as text.
what is a docstring
Allow you to define a function's purpose and usage in Python, providing documentation within the code.
How to format a docstring
‘‘‘ (number) → number
returns blah blah blah’’’
How do you leave a comment within code
#
What does the if function do
It evaluates a condition and executes a block of code if the condition is true.
What is a one way if statment
A control structure that executes a block of code only if a specified condition is true, otherwise it does nothing.
What type of function does the if function need
a condition or expression that returns a boolean value (true or false)
What is a two-way if statement
A control structure that executes one block of code if a condition is true and a different block of code if the condition is false.
What are the key terms in the two way if statement
If, else
Does else require if
yes
What does elif mean
Elif is a shorthand for "else if" in programming, allowing for multiple conditions to be checked in a two-way if statement structure. It enables the execution of different code blocks based on various conditions.
Is there a capa on elif
no
Does elif need if before it
yes
does elif need else after it
no
How does python read the if-elif-else code
Once it finds a true statement, it will ignore everything after it.
Does order matter to if-elif-else
Yes, the order of conditions matters as Python evaluates them sequentially from top to bottom.
What is Indexing
The process of accessing elements in a data structure like a list or string using their position or key.
Please call the L in APPLE (positive indexing and negative indexing)
s[3] or s[-2]
Does positive or negative indexing use 0
Positive
How do you slice strings
Call the Lower bound (included) and the Upper bound (excluded) s[lower:upper]
What is a “for” loop
A control flow statement that allows code to be executed repeatedly based on a condition. It iterates over a sequence such as a list, tuple, or string.
How many times does this for loop run:
name=’apple’
for char in name:
print (char)
6 times
dir()
A built-in function in Python that returns a list of the names in the current local scope or the attributes of an object.
help()
A built-in function in Python that provides interactive help for modules, functions, classes, or keywords, detailing their usage and documentation.
.
go to library
[::1]
Reverses words
end=” “
A parameter used in Python's print function to specify a string to be printed at the end of the output instead of the default newline character.
can you use bool in between two strings
yes
What does the range function do
The range function generates a sequence of numbers, commonly used in for loops to iterate over a sequence of numbers.
What are i, n, c in the following Range(i, n, c)
i→ starting value
n→ ending value
c→ step size
What is a list
A list is a mutable collection in Python that can hold an ordered sequence of items, allowing for duplicate entries and various data types.
Can a list contain different types of elements
Yes
Do string operators work on lists
Yes
What is .append
adds item to the end of the list
What is .pop()
Removes and returns the last item from the list
What is .sort
Rearranges the items in a list in ascending order.
What happens when you .sort list of strings
The strings are arranged in alphabetical order based on their ASCII values.
What is a while loop
Can do anything a for loop does, but a for loop can’t do evrything a for loop that a while loop. While this condition is true, it will keep running the code, even forvever. In the body there must be at least 1 line of code that has the potenital of making the while loop false.
Is a ‘for’ loop or a ‘while’ loop more efficient
They are exactly the same, convince differs.
What is lazy evaluation in python
Checks the value before and/or. Python won’t even bother to evaluate the second term, If the first is false.
Does order matter when deling with pytons AND
Yes
What is a flag in python
Some hint that tells the machine to stop.