Quiz 1 Flashcards

1
Q

computer program

A

consists of instructions: input, process, and output

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

python

A
  • conceived in late 80s by guido van rossum
  • named after british comedy group “monty python”
  • most popular = python 3.x
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

python interpreter

A

computer program that executes code written in the python programming language

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

IDE

A

programmming development is usually done with an integrated development environment (IDE) (vs code = our ide)

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

basic output

A

function print = string literal - letters/numbers/spaces/symbols (* or #) surrounded by pair of matching single or double quotes

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

basic output - variables

A

comma is used to ouput multiple items in one statement (separates multiple items)

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

basic output - variables

A

comma is used to ouput multiple items in one statement (separates multiple items)

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

errors

A

SyntaxError - violating programming language’s rules
TypeError - operation uses incorrect types
NameError - uses variale that does not exist
ValueError - invalid value is used (giving letters to int())

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

parts of a program

A
  • library imports
  • functions
  • expressions
  • statements
  • variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

parts of a program

A
  • library imports
  • functions
  • expressions
  • statements
  • variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

library imports

A

things other people have written (or you wrote outside of the script

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

statement / expression

A

program instruction that tells python to do something / evaluates and returns a value

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

function

A

block of reusable code you write yourself

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

tokens

A

keywords: def, import, if else
operators: – + - * / // % =
delimiters: () [] {} , ; : #
literals: 123 7.6 true

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

whitespace

A
  • ignored in expressions and statements
  • beginning of line = indentation
  • python uses indenation/whitespace for syntax
  • cannot appear in middle of an operator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

assignment statement

A

assigns a variable with a value using the operator =

17
Q

variable naming conventions

A
  • start with a letter [pay attention to case sensitivity]
  • dont start with a number, dont use a keyword
18
Q

data types

A

umbers, booleans, strings, and containers (lists, dictionaries, sets)

19
Q

numbers

A

int() = whole/counting numbers, positive/negatives (includes 0)
float() = numbers with decimal points

20
Q

booleans (bool)

A

true or false, often used to make decisions based on conditions

21
Q

strings

A

str() = sequence of characters which include letters, nmbers, symbols, spaces [whitespaces]
- enclosed by single/double quotes

22
Q

container

A

collection of data types - can contain data of more than one data type
- lists
- dictionaires
- sets

23
Q

lists

A
  • collection of items
  • can have diff data types inside
  • enclosed by square brackets [ ]
  • items are separated by commas ,
24
Q

dictionary

A
  • dict = collection of key-value pairs
  • keys and values can be data of any type
  • enclosed by braces { }
  • key : valu - separated by a colon
25
Q

sets

A
  • collection of unique items
  • usefule for operations like union, intersection and difference
  • enclosed by braces {}
26
Q

check data type/type conversions

A

function type() / convert one data type to another - (converting integer to string)