Pre Midterm Terms

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 92

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

93 Terms

1

+

add

New cards
2

-

Subtraction

New cards
3

*

multiplication

New cards
4

/

division

New cards
5

//

the quotient (sans decimal)

New cards
6

%

Remainder

New cards
7

**

To the power of

New cards
8

abs()

Absolute Value

New cards
9

min() and max()

min and max of a set of numbers

New cards
10

<

less than

New cards
11

>

greater than

New cards
12

==

equivalent too

New cards
13

!=

not equal too

New cards
14

<=

less than or equal to

New cards
15

>=

greater than or equal to

New cards
16

and

99% T and 1%F, then false

New cards
17

or

99% F and 1%T, then true

New cards
18

not()

negation of the inside of the bracket

New cards
19

Integers

Be represented exactly. There is no limits to their size (other than the size of you memory)

New cards
20

Floating points

approximation of real numbers.

New cards
21

What forces a float

division

New cards
22

what must one do after defining a function

tab in

New cards
23

general form for a function

def f(x):

New cards
24

what must you call to use pi or sqrt

import math

New cards
25

if a function has two variables listed how many does it need to exist

2

New cards
26

What is a library

Widely understood code (for example math) that is imported to make life easier

New cards
27

what does the print function do

ONLY outputs, can not use the function after printing

New cards
28

what does the return function do

outputs and allows you to use the answer in future code

New cards
29

what does the function \n do

prints a new line

New cards
30

how can you type words or expressions

print(‘ ‘)

New cards
31

What is a string

Custom texts using ‘ ‘ or “ “

New cards
32

What does Type do

Tells you the type of variable the function will return

New cards
33

what does a single \ do in a string

Over rides the special meaning of the following character.

New cards
34

How can you use an apostrophe in a string only using qoutes

“blah’s”

New cards
35

\n

Prints a new line

New cards
36

\t

prints a tab

New cards
37

\n\t

creates a new line with a tab space

New cards
38

Can you add two strings together

yes

New cards
39

Can you add an integer / float with a string

No

New cards
40

How do you type just a space using a string

“ “.

New cards
41

How do you get a space between two strings

use a comma to separate parameters

New cards
42

What does len do

returns the number of items in an object, such as a string or list.

New cards
43

Is a string a collection

Yes

New cards
44

\b

deletes pervious characterin a string or text.

New cards
45

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.

New cards
46

What does input do

Input allows the user to provide data to a program, typically via keyboard or other input devices.

New cards
47

What type of function does input take when you type

a string

New cards
48

What does int do

Int converts a value to an integer data type, allowing numerical operations on the value.

New cards
49

What does float do

Float converts a value to a floating-point data type, enabling calculations with decimal numbers.

New cards
50

What does ‘in’ do

Finds if a string is a subset of another set

New cards
51

What does “not in”

Finds if a string does not have the subset listed

New cards
52

What does str do

Converts a value to a string data type, allowing for the representation of non-string values as text.

New cards
53

what is a docstring

Allow you to define a function's purpose and usage in Python, providing documentation within the code.

New cards
54

How to format a docstring

‘‘‘ (number) → number

returns blah blah blah’’’

New cards
55

How do you leave a comment within code

#

New cards
56

What does the if function do

It evaluates a condition and executes a block of code if the condition is true.

New cards
57

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.

New cards
58

What type of function does the if function need

a condition or expression that returns a boolean value (true or false)

New cards
59

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.

New cards
60

What are the key terms in the two way if statement

If, else

New cards
61

Does else require if

yes

New cards
62

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.

New cards
63

Is there a capa on elif

no

New cards
64

Does elif need if before it

yes

New cards
65

does elif need else after it

no

New cards
66

How does python read the if-elif-else code

Once it finds a true statement, it will ignore everything after it.

New cards
67

Does order matter to if-elif-else

Yes, the order of conditions matters as Python evaluates them sequentially from top to bottom.

New cards
68

What is Indexing

The process of accessing elements in a data structure like a list or string using their position or key.

New cards
69

Please call the L in APPLE (positive indexing and negative indexing)

s[3] or s[-2]

New cards
70

Does positive or negative indexing use 0

Positive

New cards
71

How do you slice strings

Call the Lower bound (included) and the Upper bound (excluded) s[lower:upper]

New cards
72

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.

New cards
73

How many times does this for loop run:

name=’apple’

for char in name:

print (char)

6 times

New cards
74

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.

New cards
75

help()

A built-in function in Python that provides interactive help for modules, functions, classes, or keywords, detailing their usage and documentation.

New cards
76

.

go to library

New cards
77

[::1]

Reverses words

New cards
78

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.

New cards
79

can you use bool in between two strings

yes

New cards
80

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.

New cards
81

What are i, n, c in the following Range(i, n, c)

i→ starting value

n→ ending value

c→ step size

New cards
82

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.

New cards
83

Can a list contain different types of elements

Yes

New cards
84

Do string operators work on lists

Yes

New cards
85

What is .append

adds item to the end of the list

New cards
86

What is .pop()

Removes and returns the last item from the list

New cards
87

What is .sort

Rearranges the items in a list in ascending order.

New cards
88

What happens when you .sort list of strings

The strings are arranged in alphabetical order based on their ASCII values.

New cards
89

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.

New cards
90

Is a ‘for’ loop or a ‘while’ loop more efficient

They are exactly the same, convince differs.

New cards
91

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.

New cards
92

Does order matter when deling with pytons AND

Yes

New cards
93

What is a flag in python

Some hint that tells the machine to stop.

New cards
robot