Comp 110 - Quiz 00

0.0(0)
studied byStudied by 4 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/52

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

53 Terms

1
New cards

function definition

does not result in a value unless you call it

2
New cards

parametrized function definition

you can subsitute input arguments, follow the same steps and get different, but intentional, results

3
New cards

anatomy of a function signature

define, function name,parameters list, return type , ends with :

4
New cards

function signature written out

def name_of_function (parameter:type) -> returnType:

5
New cards

anatomy of a function definition

define,function name,parameter list, return type, function body (docstring,return statement)

6
New cards

function definition written out

def name_of_function (parameter:type -> returnType

“““Docstring description of the function.”””

return expression_of_type_returnType

7
New cards

Indentation rules

each statement in the body is indented by at least 1 level

8
New cards

return statements

written inside of function definitions, “stop following this function here and send my caller the results”

9
New cards

anatomy of a function call

name_of_function(argument=value)

10
New cards

argument list

a list of the input values for the parameters

11
New cards

what are expressions

intent to do something

12
New cards

what does an expression evaluate to

to a typed value at runtime

13
New cards

**

exponentation

14
New cards

*

multiplication

15
New cards

/

division

16
New cards

//

integer division

17
New cards

%

Remainder (modulo)

18
New cards

+

addition

19
New cards

-

subtraction

20
New cards

negation

-

21
New cards

Order of operations in python

P ()

E **

MD */%

AS +-

22
New cards

Addition numerical values rule

add the values together

23
New cards

addition string rules

concatenate them

24
New cards

addition concatination example

“comp”+”110”=”comp110”

25
New cards

addition result types (float)

float +float= float

int+float=float

26
New cards

addition result type (int)

int+int=int

27
New cards

addition result type (str)

str+str=str

28
New cards

what happens when you try to add incompaible types

you get an error

29
New cards

subtractions is meant strictly for…

numerical values

30
New cards

subtraction result type (float)

float-float=flolat

float-int=float

int-float=float

31
New cards

subtraction result type (int)

int-int=int

32
New cards

multiplation numerical rules

if numerical objects multiply the values

33
New cards

multiplation string and int rules

if string and int, repeat the strings int number of times

34
New cards

multiplication string and int example

“Hello”*3=”HelloHelloHello”

35
New cards

multiplication result type (float)

float*float=float

float*int=float

int*float=float

36
New cards

multiplication result type (int)

int*int=int

37
New cards

multiplication result type (str)

str*int=str

38
New cards

Division numerical rules

meant strictly for numerical values

39
New cards

Division rule (important)

division always results in a float

40
New cards

division result type

EVERY TYPE RESULTS IN FLOAT

41
New cards

integer division result type (int)

int // int=int

42
New cards

integer division result type (float)

float // float=float

float//int=float

int//float=float

43
New cards

Remainder “modulo” numerical type

calculates the remainder when you divide 2 numbers

44
New cards

remainder result type (int)

int %int =int

45
New cards

remainder result type (float)

float%float=float

int%float=float

float%int=float

46
New cards

remainder even rules

if x is even, x%2 = 0

47
New cards

remainder odd rules

if x is odd, x%2 is 1

48
New cards

exponential numerical types

raise the first power to the second

49
New cards

exponent result type float (float)

float**float=float

float**int=float

int**float=float

50
New cards

exponent result type (int)

int**int=int

51
New cards

relational operators

always result in a true of false value

52
New cards

==,≠

commonly used in programing to reperesent not, can be used for all primitive types weve learned

53
New cards

>,>=,<,<=

can only be used on floats and ints