APCO 1P00 Midterm

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/84

encourage image

There's no tags or description

Looks like no tags are added yet.

85 Terms

1
New cards

Program

A file that usually contains one or more functions. Each function's definition starts with the "def" keyword

2
New cards

Function

a chunk of code (statements) that performs an action. Functions are given names and are reusable

3
New cards

Built-in Function

such as 'sqrt()' and 'int()'

4
New cards

User Defined Functions

functions that you create

5
New cards

Statment

a line of code which instructs Python to "do something". In JES, it is a line of code written either in the Command or Program areas. Normally have an expression inside them

6
New cards

Comment

one particular case where Python does NOT do something is called this. (side note for creator)

7
New cards

Expression

a piece of code (part of a statement) that can be evaluated to give a result.

8
New cards

Value

an expression which evaluates to itself. often called a 'constant'

9
New cards

Variable

just like in algebra, this is a name (in Python, often relevant 'words') that you can assign a value too, allowing you too reuse, for later use. Often also called a Lebel, identifier, or container

10
New cards

Operator

a mathematical symbol. This appears between two sub-expressions, and the combination of two sub-expression with the symbol forms a new larger expression

11
New cards

Type

the variables and expressions can be placed into different categories. This id often determines by the content in which it is used

12
New cards

Keyword

a word in Python that has already been given a meaning or purpose. Cannot be used as a variable name by you. ex; if, while, for, print, and

13
New cards

Assignment

the act of giving a value to a variable. One can imagine the "=" as a left arrow

14
New cards

Error

When your program has a problem

15
New cards

Arithmetic Processing

expressed using standard mathematical notation within the limitations imposed by a keyboard

16
New cards

Addition

+

17
New cards

Subtraction

-

18
New cards

division

/

19
New cards

%

modulo (remainder)

20
New cards

*

multiplication

21
New cards

**

exponentiation

22
New cards

String

anything in " " or ' '

23
New cards

s.count (substring)

returns number of occurrences of substring in "s"

24
New cards

s.find (textToSearchFor)

returns index or -1 if not found

25
New cards

s.rfind (textToSearchFor)

reverse fine, from end of string. Returns index or-1 if not found

26
New cards

Changing strings

remember that strings are immutable so to make a change "stick" you have to do, e.g. s=s.title()

27
New cards

list = s.split (characterToSplitOn)

Converting string to a list

28
New cards

s.join(list)

list to string. where e is the string to join the elements of list

29
New cards

Output

use 'print' to display stored values in the command or interactions are

30
New cards

requestNumber(message)

a dialogue box is opened, with the 'message' as a prompt for the user to enter a number

31
New cards

requestInteger(message)

a dialogue box is opened, with the 'message' as a prompt for the user to enter an integer

32
New cards

requestString(message)

a dialogue box is opened, with the 'message' as a prompt for the user to enter a string value

33
New cards

Relational Expressions

These look like standard arithmetic comparisons (but again with the limitations imposed by using a standard keyboard)

34
New cards

<

less than , eg. 5

35
New cards

less than or equal too

36
New cards

==

equal

37
New cards

!=

not equal

38
New cards

>=

greater than or equal

39
New cards

>

greater than

40
New cards

and

a and b, only true when a is true and b is true

41
New cards

or

a or b, is True when a is true, or when b is true, or when both a and b are true

42
New cards

not

not a, is true when a is false

43
New cards

if

use this to execute one clock of code or another, but not both

44
New cards

Range function

the built- in function created arithmetic lists, and is often used to produce the lists to drive for loops

45
New cards

for

use to execute a block of code known number of times

46
New cards

while

use to execute a code multiple times

47
New cards

while again

used to repeat a program

48
New cards

Lists

items separated by commas and placed inside square brackets [ ]

49
New cards

list1 + list2

concatenates the two lists

50
New cards

list [ i }

access element number i in list

51
New cards

len(list)

returns the number of elements in list

52
New cards

del list [ i ]

deletes element number i from list

53
New cards

list. append (value)

appends value from list

54
New cards

list. sort()

sorts the elects in list

55
New cards

list. reverse()

reverses the order of the elements in list

56
New cards

list.index(value)

returns the position of the first occurrence of value in list

57
New cards

list.insert (i, value)

inserts value into list at position i

58
New cards

list. count (value)

returns a count of the number of times value occurs in list

59
New cards

list.remove (value)

deletes the first occurrence of value in list

60
New cards

list.pop()

deletes and returns the last value in list

61
New cards

value in list

is true if value occurs in list and false otherwise

62
New cards

Text file processing

to read a file a line at a time

63
New cards

Function max()

takes any number of arguments and returns the largest value

64
New cards

Function min()

takes any number of arguments and returns to the smallest value

65
New cards

Computer Science

study of programs

66
New cards

Computer Scientists Study

how the programs are written, units used in the programs, what can programs be written for, how well the programs work with humans

67
New cards

Recipe

very similar to program

68
New cards

Algorithm

English, process description that is independent of any programming language

69
New cards

Ordered Steps

one after another (like following a recipe)

70
New cards

constants

may change the value (increase or decrease) depending on what is needed for the program

71
New cards

Key Concept

The computer does the work

72
New cards

Python

a language implemented in C

73
New cards

Jython

same language implemented in Java

74
New cards

Digitizing Media

encoding media into numbers, once converted, they can be used in a computer

75
New cards

Alan Perlis

Argued in 1961 that Computer Science should be apart of a liberal education: Everyone should learn to program

76
New cards

Programming

Exposes you to computational thinking

77
New cards

Floating Point

numbers with decimal points. also called real numbers or floats

78
New cards

Names

inside a function only have meaning while the function is being executed by the computer

79
New cards

File

Collection of bytes, with a name, that resides on some external medium like a hard disk

80
New cards

Directory

where the file is stored

81
New cards

base file name

the actual name of the file

82
New cards

file extension

indicates the type of file

83
New cards

Path delimiters

typically /\ to break up directory levels

84
New cards

JES

Jython Environment for Students: a simple editor in the program area

85
New cards

Names:

must start with a letter, no spaces, case sensitive, unique, don't use key words