• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/76

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

76 Cards in this Set

  • Front
  • Back

end=' '

Specifies that next print appears on same line

\n

Creates a new line of text within a literal string

string literal

A piece of text to be printed

\\

backslash

\'

Single quote

\"

Double quote

\t

Tab (indent)

\

escape sequence

Raw string

A string whose syntax has not been executed. Specified by adding 'r' to a string

input ()

Assigns a user input to a variable

SyntaxError

The program contains invalid code that cannot be understood

IndentationError

The lines of the program are not properly indented

ValueError

An invalid value is used

NameError

The program tries to use a variable that doesn't exist

TypeError

An operation uses incorrect types

%

Modulo operator

value

A value such as 20, 55...

Type

The type of the object, such as integer or string

Identity

A unique identifier that describes the object

type()

Prints the type of an object

Mutability

Whether a given object's value is allowed to change

id ()

Gives the identity of a given object

Numeric types

Int, float. Support normal mathematical operations

Sequence types

String, list, tuple

tuple

An immutable container with ordered elements

sequence type

A type of string that specifies a collection of objects ordered from left to right

index

Position of a character in a string

len()

Finds the length of a given string or sequence

How can a programmer print a character given it's index?

Using brackets to contain the index, a programmer can print that index's corresponding character.



ex: print(alphabet[0]) would output A

How can a programmer quickly refer to the last character in a string?

string[-1]

True or False: individual string values can be altered

False. Strings are immutable objects. To alter a character, an assignment statement must be used to update the entire string variable

string concatenation

The process of adding new characters to the end of a string.



Ex:


string1 = 'abc'


string2 = '123'


concatenated string = string1 + string2


int()

Converts integers, floats, integer-only strings to integer type

float()

Converts integers, floats, or strings with integers and fractions to floats

str()

Converts anything to a string

argument

Item passed to a function

math.ceil

Round up value

math.factorial

Factorial

math.fmod

Remainder of division

math.exp

Exponential function

math.exp

Exponential function

math.pow

Raise to power

math.acos

Arccosine

math.atan

Arctangent

math.cos

cosine

math.hypot

Length of vector from origin

math.radians

Converts degrees to radians

math.cosh

Hyperbolic cosine

math.gamma

Gamma function

math.pi

Pi

math.fabs

Absolute value

math.floor

Round down value

math.fsum

Floating point sum

math.log

Natural logarithm

math.sqrt

Square root

math.asin

Sine

math.atan2

Arctangent with 2 parameters

math.sin

Sine

math.degrees

Converts from radians to degrees

math.tan

Tangent

math.sinh

Hyperbolic sine

math.erf

Error function

math.e

e

operator chaining

Multiple comparisons performed left to right

elif

Keyword short for "else if"

nesting

Placing an if-else statement inside an if-else statement

Boolean

A value that is either true or false

membership operators

"In" and "not in" yield true or false if the left operand matches the value of some element in the right operand (a container)

substring

String of characters within a larger string

membership operators

"is" and "is not"

code block

Group of statements grouped together by indentation level

def function()

Defines a custom function or subroutine

namespace

Maps names to objects

locals() globals()

Shows all names in the local or global namespace

Scope

Area of code where a name is visible

Scope resolution

The process of searching for a name in the available namespaces