BSAN 310 Programming

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

1/31

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.

32 Terms

1
New cards

Key Words

Predefined words used to write program in high level language. Each key word has specific meaning (e.g. import, if, for)

2
New cards

Operators

Perform operations on data. Ex: Math operators to perform arithmetic.

3
New cards

Syntax

Set of rules to be followed when writing program.

4
New cards

Statement

Individual instruction used in high-level language.

5
New cards

Variable

Name that represents a value stored in the computer memory. Used to access and manipulate data stored in memory. A variable references the value it represents.

6
New cards

Assignment statement

Used to create a variable make it reference data. General format is variable = expression. Ex: age = 29.

7
New cards

Condition

The if statement, Python syntax: if condition then result.

8
New cards

The if-else statement

Dual alternative decision structure: two possible paths of execution. One is taken if the condition is true, the other if false.

9
New cards

If-elif-else statement

Simpler to write, can include many. If condition, statements, elif, else.

10
New cards

The While Loop: Condition-Controlled

While: While condition is true, do something.

11
New cards

The While Loop Parts

Two Parts:

  • Conditions tested for true or false value

  • Statements repeated as long as condition is true

12
New cards

While Loop Format

General Format:

While condition:

         statements

In flow chart, line goes back to previous part

13
New cards

The For Loop: A count-Controlled Loop

Iterates a specific number of times. Designed to work with sequence of data items. Iterates once for each item in the sequence.

14
New cards

For Loop Format

for variable in [val1, val2, etc]:
statements

15
New cards

Target Variable

The variable which is the target of the assignment at the beginning of each iteration

16
New cards

Funtion

Group of statements within a program that perform as specific task. Usually one task of a large program.

Can be executed in order to perform overall program task. Known as divide and conquer approach.

17
New cards

Function definition

Specifies what function does

def function_name():

statement

statement

18
New cards

Function header

First line of function. Includes keyword def and function name, followed by parentheses and colon.

19
New cards

Block

Set of statements that belong together as a group. Ex: the statements included in a function

20
New cards

Argument

Piece of data that is sent into a function. Function can use argument in calculations. When calling the function, the argument is placed in parentheses following the function name.

<p>Piece of data that is sent into a function. Function can use argument in calculations. When calling the function, the argument is placed in parentheses following the function name.</p>
21
New cards

Lists

An object that contains multiple data items. Anything with brackets.

22
New cards

Element

An item in a list

23
New cards

Format of List

list = [item1, item2, etc.]

24
New cards

Print function

Can be used to display an entire list

25
New cards

Tuple

An immutable sequence. Once it is created it cannot be changed.

26
New cards

Tuple Format

tuple_name = (item1, item2)

27
New cards

Tuples support operations as lists

  • Subscript indexing for retrieving elements

  • Methods such as index

  • Built in functions such as len, min, max

  • Slicing expressions

  • The in, +, and * operators

28
New cards

Dictionary

Object that stores a collection of data. Each element consists of a key and a value. To retrieve a specific value, use the key associated with it

29
New cards

Key and value

Often referred to as mapping of key to value. Key must be an immutable object

30
New cards

Dictionary Format

dictionary =

                {key1:val1, key2:val2}

31
New cards

Set

Object that stores a collection of data in same way as mathematical set

32
New cards

Set Requirements

All items must be unique. Set is unordered. Elements can be of different data types. For empty set, call set().