Python and Probability Midterm Flashcards (Midterm 2)

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

What does the if-statement do?

It controls execution flow, running a code block if and only if the conditional is true

2
New cards

Which code runs when the conditional is false?

The else statement is used to run a block of code only when the preceding if conditional is false

3
New cards

Six comparison operators for Python conditionals?

==, >, >=, <, <=, and !=

4
New cards

Why use parentheses in complex Pandas conditionals?

Parentheses ensure the correct order of evaluation, as Python defaults to combining ANDs (&) before ORs (|)

5
New cards

Keyword to define a new function?

The Python keyword def is used to define a new function

6
New cards

What are variable placeholders in a function called?

These placeholders are called arguments (or parameters)

7
New cards

Make a function argument optional, how?

By setting a default argument value in the function definition ( e.g., def function(arg = value): )

8
New cards

What does the term for standard deviation mean?

Standard Units or Z scores, which indicate how many standard deviations a value is from the average

9
New cards

Function for area left of Z-score?

norm.cdf(z_score) (cumulative distribution function) from typing "from scipy.stats import norm"  (norm.ppf for percentages)

10
New cards

Standard normal curve's mean value?

The standard normal curve is centered at 0 and has an average (mean) of 0

11
New cards

Define probability or chance.

The expected percentage of times a certain outcome occurs when a process is repeated over and over

12
New cards

Define event's sample space.

The set of all possible outcomes of that event

13
New cards

Define the probability's complement rule.

P(event)= 1 minus the probability it does not happen

14
New cards

Addition Rule for non-mutually exclusive events?

P(A or B)=P(A)+P(B)−P(A and B) (The subtraction avoids double counting)

15
New cards

Mutually exclusive events: what is P(A and B)?

If events are mutually exclusive (Special Case), P(A and B) is 0

16
New cards

Multiplication Rule for independent events?

P(A and B)=P(A)×P(B)

17
New cards

Multiplication Rule for dependent events?

P(A and B)=P(A)×P(B∣A) (where P(B∣A) is the conditional probability)

18
New cards

Define conditional probability P(B | A).

The probability that event B will occur given that event A has already occurred

19
New cards

Bayes' Rule expresses what probability?

P(B|A)=P(A|B)×(P(B)/P(A))

Explore top flashcards