section 2-prgramming Flashcards
languages
languages have functions that manually convert between data types (e.g string_to_int)
data types
integer = whole numbers only real(float) =numbers with decimals boolean = true or false values character = a single letter,number,symbol... string = represents texts
operations
+ addition - subtraction
*multiplication / division
div= whole number mod=remainder
assignment operator
the assignment operator arrow or = is used to assign values to to a variable
comparison operators
are things like equal to ,greater than….
data values
data values can be stores as constants or variables ,
constants and variables need to be declared before use
constants
a constant is assigned to a value at design time
variables
a variable on the other hand can be changed which therefore makes them more useful
strings
strings are a data type made up of characters ,when manipulating strings you start at 0
inputs
inputs can be received from many devices (keyboards ,mouses,webcam….)
outputs
outputs are typically displayed (monitors)
if statements
if statements allow you to check if a condition is true or false.
more complex if statements can be made by putting one if statement inside another one
else if statements
else if statements are used to check multiple conditions and if they give out different outputs
case statements
case statements can check is a variable have specific values
repeat until loop
controlled by a condition or until a condition is true, you get an infinite loop if the condition is never true.
(same as ado until loop)
while loops
while loops keep going while the condition is true .while loops are controlled by a condition at the start of the loop
do-while loops
controlled by end of the loop.keep while if the condition is true
for loops
for loops will repeat the code inside a fixed number of times.for loops are a type of definite iteration
nested iteration
is typically having a loop inside another
boolean operators
look in revisions guide!!!
generating random numbers
random.int()
random numbers
random numbers generate random selections(e.g stimulate a coin toss)
using LEN()
the number of elements in an array can be found using the LEN() just like for strings
arrays
arrays are a data structure that can store a group of data values of the came type ,under one name