Exam 1 Flashcards

1
Q

Integers

A

Int
5, 29, 1,356

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Float

A

float
12.5, 6.9, 7.00

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Strings

A

str
“Hellos World!”, “Apple”, “5”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Boolean

A

bool
True, False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Assignment Statements

A

Update the value in a variable
One equal sign

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Equality Operations

A

Ask a question about values
Use two equal signs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Tracing

A

Track the value of variables over time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Write Comments

A

comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Use other modules in Python programs

A

import module name
from module name import keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Membership

A

Check whether the first string is in the second string
“in” or “not”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Subscripting

A

Extract one or more characters from the string
print(message[0])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Subscript

A

variable or string literal[index #]
[#:#]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Name error

A

Try to reference a variable that doesn’t exist yet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Type error

A

Use an operator incorrectly
Ex. Adding a string & number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Syntax error

A

Broke Python’s rules of spelling, grammar, and punctuation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Functions

A

Reusable chucks of code that can be used to build up more complicated programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Calling functions

A

How functions are used
(Name of function)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Arguments

A

Values given to functions that affect the behavior of the function
Values that go inside the parentheses
( , )

19
Q

Returned values

A

Data that comes out at the bottom of the box

20
Q

Defining functions

A

def(name of function)

21
Q

Parameters

A

Formal names for expected arguments to the function and expected types of those names
Become variables for the function to use

22
Q

Docstring

A

String literal value that explains the functions purpose
Indented tripe quoted string “””

23
Q

Unit testing

A

Show an example input & output when the function is working correctly
assert_equal(input,output)

24
Q

Scope

A

A body that controls the lifetime of variables

25
Q

Print

A

Takes in arguments and writes to the console
print( )

26
Q

Input

A

Function reads from the console and returns it as a string value

27
Q

Function header

A

def name(parameter 1, parameter 2):

28
Q

Parameter types

A

int, str, float, bool, none

29
Q

How many unit tests?

A

of lines of code that are executed /# of lines of code you’ve written

30
Q

Body

A

Indented region of code

31
Q

Global variables

A

Variables defined at the top
Lives til the end of the program

32
Q

Local variables

A

Defined inside the body of the function or parameter
Only exists inside the function

33
Q

Multi line comment

A

indent “””
Indent Thus function…

Indent Args:
title(str): …

Indent Returns:
str: …
Indent “””
Args=parameters & Returns=returned values

34
Q

Frame

A

Scope that the local variables are inside
Used to show current variables and their values

35
Q

Stack

A

Call a function inside another function

36
Q

Flooring

A

remove any decimals
Truncation

37
Q

Use designer from BlockPy library

A

Takes an object & an angle: draw( ), turn_left( , )
Takes a function & coordinate pair: set_xy( , )
Takes an object & new scale multiplier: grow( , )

38
Q

If statement

A

Body of code that is executed based on a condition
Used to control the flow of a program
if
elif:
else:

39
Q

Truthiness

A

Ability to use any type of value as a conditional, not just booleans
int & float: non zero values are considered true
str: any non-empty string is considered true

40
Q

Nesting

A

Putting if statements inside of if statements and functions

41
Q

When

A

Function that consumes the name of an event and a function to call later

42
Q

if

A

Statements that has a conditional expression and a body to execute now

43
Q

Lists

A

A new type that can hold multiple values of the same type
[element1,element2,etc]

44
Q

Dataclasses

A

A way of making new types that combine multiple bits of different kinds of data into one bundle