Programming Flashcards
What is a variable
Any value that will change unless it’s a constant
Variables must be declared with
In python one statement that includes the data type
Different data types ares
Integer- whole number Boolean- two choices Character - symbol on keyboard (single) String- zero or several symbols Float/Real- fractional number
Constant variable
A variable that is the same throughout the program
Benefits of constant variables are
Easy to debug program
Easy to change value as it only needs to be changed once eg VAT
2 types of operations
Arithmetic and comparison do stuff to specific pieces of data
Num1=input
Num2=input
Num3=Num1+Num2
prints”the same is “,Num3)
What will happen and why
It’s will join the numbers together (concatenation) because it hasn’t been changed to int
Sequence-
Series of steps in specific order
Selection
Choice , IF THEN ELSE
Nested iteration and selection
A loop within a loop
Choices made within the process of making a choice
A robust code is
A code that will not crash and will anticipate unexpected user inputs
Arrays
A list with only one data type
Benefits of arrays
Easily debugged
Easily processed
Iteration
For is definite
While is indefinite
Repeat….until is indefinite
Data structure
Grouping data items together so are treated as a set
Subroutine
A named self contained section of the code that performs a specific task.
Def()