# Ch2: Basic Types, Operators & Module

Studied by 0 people
0.0(0)
get a hint
hint

floating point number

1 / 101

## Tags and Description

### 102 Terms

1

floating point number

any number with a decimal

New cards
2

floating point literal

written fractional part of any number

New cards
3

overflow error

occurs when a value is too large to be stored in an interpreter

New cards
4

f’{num:.#f}’

print out only a certain number of digits following a decimal

New cards
5

literal

a specific value in code; not a variable

New cards
6

operator

a symbol that performs a built-in function

New cards
7

precedence rules

PEMDAS, negatives numbers are evaluated after exponents

New cards
8

unary minus

negative symbol

New cards
9

compound operators

provide a shorthand way to update a variable

New cards
10

age + = #

age = age + #

New cards
11

age - = #

age = age - #

New cards
12

age * = #

age = age * #

New cards
13

age / = #

age = age / #

New cards
14

age % = #

age = age % #

New cards
15

division operator (/)

performs division, quotient is a float

New cards
16

floor division (//)

rounded down division, returns whole number

New cards
17

modulo (%)

decimal remainder from division, in form of whole number

New cards
18

import math

python’s built-in math module

New cards
19

function

list of statements that can be executed simply by using the ________ name

New cards
20

function call

process of invoking/calling a function

New cards
21

argument

what a function is referring to

New cards
22

math.ceil(x)

round-up value

New cards
23

math.factorial(x)

factorial

New cards
24

math.fmod(x,y)

remainder of divison

New cards
25

math.fabs(x)

absolute value

New cards
26

math.floor(x)

round-down value

New cards
27

math.fsum

floating-point sum of range, list, array

New cards
28

math.exp(x)

exponential function e^x

New cards
29

math.pow(x,y)

raise x to power y

New cards
30

math.log(x, (base))

natural log; base is optional

New cards
31

math.sqrt(x)

square root

New cards
32

math.acos(x)

arc cosine

New cards
33

math.atan(x)

arc tangent

New cards
34

math.cos(x)

cosine

New cards
35

math.hypot(x1,x2…)

lenght of vector from origin

New cards
36

New cards
37

math.cosh(x)

hyperbolic cosine

New cards
38

math.asin(x)

arc sine

New cards
39

math.atan2(y,x)

arc tangent with two parameters

New cards
40

math.sin(x)

sine

New cards
41

math.degrees(x)

New cards
42

math.tan(x)

tangent

New cards
43

math.sinh(x)

hyperbolic sine

New cards
44

math.gamma(x)

gamma function

New cards
45

math.erf(x)

error function

New cards
46

math.pi

pi (constant)

New cards
47

math.e

e (constant)

New cards
48

import random

required to enable random module

New cards
49

random()

return random floating point value; range 0 ≤ x ≤ 1

New cards
50

randit(min,max)

returns random integer between min and max (inclusive)

New cards
51

randrange()

generated random integers within a range; 0 ≤ x ≤ (#-1)

New cards
52

randrange(min,max)

returns random integer between min and max-1 (max exlusive)

New cards
53

seed

current time when random number is generated

New cards
54

visual inspection

looking through to find the bug

New cards
55

debug output statements

output determines if the statement functions (runs line by line)

New cards
56

hierarchical debugging

more efficient method for debugging large programs

New cards
57

unicode

a feature of python that uses numbers to represent every possible character

New cards
58

code point

the unique numbers used in unicode

New cards
59

escape sequence

stated by \, interpreter look for what comes after

New cards
60

\\

prints ‘\’

New cards
61

\’

prints “ ‘ “

New cards
62

\”

prints ‘ “ ‘

New cards
63

\n

newline

New cards
64

\t

tab/indent

New cards
65

raw string

used to ignore escape sequences, will just print everything including backslashes

New cards
66

r ’string’

raw string

New cards
67

ord()

encoded integer value for a string of length one

New cards
68

chr()

returns a character for the number entered

New cards
69

len()

length of a string

New cards
70

[ ] (brackets)

how to access character index

New cards
71

string concatencation

a program adding new characters to the end of a string

New cards
72

type conversion

converting one type to another

New cards
73

implicit conversion

a type of conversion that automatically happens without manually converting (ex int to float)

New cards
74

index

integer matching a specific position in a string

New cards
75

slice notation

creates new string from range imputed

New cards
76

stride

determines how many elements are between extracted items

New cards
77

replace(old,new)

replaces all of the old phrase with the new given one

New cards
78

replace(old,new,count)

replaces old phrase only a certain number of times

New cards
79

string.find(x)

returns index of time in a string

New cards
80

string.find(x,start)

begins searching at specific index

New cards
81

string.find(x,start,end)

search in a certain range

New cards
82

string.rfind(x)

searches string in reverse

New cards
83

string.count(x)

returns number of times x occurs

New cards
84

string.capitalize()

capitalizes first letter only in a string

New cards
85

string.lower()

makes whole string lower case

New cards
86

string.upper()

makes whole string upper case

New cards
87

string.strip()

leading and trailing white space is removed

New cards
88

string.title()

first letters of each word are capitalized

New cards
89

string.isalnum

true; if all upper/lower case or nums 0-9

New cards
90

string.isdigit

true; if all numbers are 0-9

New cards
91

string.islower

true; if all lower case

New cards
92

string.isupper

true; if all upper case

New cards
93

string.isspace39

true; if all characters are white space

New cards
94

string.startswith(x)/endswith(x)

true; if starts/ends with x

New cards
95

replacement field

a place holder expression (ex { })

New cards
96

format specification

inside a replacement field allows a value’s formatting to be customized

New cards
97

presentation type

part of format specification; determines how to represent value in text form

New cards
98

string multiplication/replication

repeats a string a specified number of times

New cards
99

field width

defines the minimum number of characters that must be inserted ion a string

New cards
100

alignment character

determines how a value should be aligned within the width of the field

New cards

## Explore top notes

Note
Studied by 14 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 15 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 8 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 9 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 13 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 7 people
Updated ... ago
5.0 Stars(1)
Note
Studied by 139 people
Updated ... ago
5.0 Stars(3)
Note
Studied by 68 people
Updated ... ago
5.0 Stars(1)

## Explore top flashcards

Flashcard51 terms
Studied by 94 people
Updated ... ago
5.0 Stars(2)
Flashcard54 terms
Studied by 6 people
Updated ... ago
5.0 Stars(1)
Flashcard38 terms
Studied by 13 people
Updated ... ago
5.0 Stars(1)
Flashcard452 terms
Studied by 67 people
Updated ... ago
5.0 Stars(1)
Flashcard30 terms
Studied by 43 people
Updated ... ago
5.0 Stars(1)
Flashcard51 terms
Studied by 5 people
Updated ... ago
5.0 Stars(1)
Flashcard41 terms
Studied by 7 people
Updated ... ago
5.0 Stars(1)
Flashcard32 terms
Studied by 17 people
Updated ... ago
5.0 Stars(2)