Part 2, Introduction to problem solving in python Flashcards
what is one way of expressing in an algorithm that we need to do something for a number of times
when designing an algorithm what signs can be used to represent the problem(1) and any subproblems(2)
- >
- >>
- this is used to hold many values within a single variable
- each item within this is known as an element and each element can be accessed via its index number, that is its position inside the —- starting from 0
what is a list, and what terms are used to desribe its parts
in python this is used to return a sequence of numbers
what is the python range() function used for
these can be translated into code by creating them as comments within the code
the symbols > and >> can be used to represent the problem and any subproblems of an algorithm, how do these later translate into code
range(start, stop, step)
- start - the number you would like to start from (included in sequence)
- stop - the number you would like to stop at (excluded from sequence)
- step - the increment of the sequence (default 1)
describe the python range() parameters
what is a list, and what terms are used to desribe its parts
- this is used to hold many values within a single variable
- each item within this is known as an element and each element can be accessed via its index number, that is its position inside the —- starting from 0
will print ‘hello world’ and then a space (does not start a new line)
describe what the following python code does
Print(‘hello world’, end = ‘ ’)
this is of the form “variable = expression”. The expressions value is found first and then stored inside the variable.
what is an assignment
what are the 7 steps of the problem solving process
- problem
- decompose
- sub problems
- decompose
- algorithm
- implement
- code
A statement where some code only gets executed under certain circumstances, determined by a boolean condition
what is a conditional statement
what is one way of expressing in an algorithm that we need to do something for a number of times
describe what the following python code does
Print(‘hello world’)
will print ‘hello world and start a new line
describe what the following python code does
Print(‘hello world’, end = ‘ ’)
will print ‘hello world’ and then a space (does not start a new line)
describe the python for loop syntax
for x in (list, a tuple, a dictionary, a set, or a string)