Unit 6 - Problem Solving with Programming Flashcards
Why are input and output commands used?
They allow the computer to receive information from the user and to output the data back to the user after it has undergone processes
How do you know whether input and output commands are correct?
They are highlighted in purple
Define a variable
A variable is a container within which you can store data which can then be referenced later on
List the 4 rules of when creating a variable
- It is not one of the reserved words
- Variable names are case sensitive
- A variable name has to begin with an underscore or a letter
- Variable names can include numbers or letters
List the 5 main data types
- String
- Float
- Boolean
- Integer
- Character
List the 5 main conversion commands
- str()
- bool()
- int()
- char()
- float()
What is a string function?
These are built in commands which can be applied to variables in python
Give an example of a string function
- len()
- isalpha()
- isupper()
- islower()
- isdigit()
- capitalize()
- round()
What are operators?
Operators are built in functions that allow you to perform specific functions
What are the three types of operator and give examples
Relational: >, =, !=, ==
Arithmetic: +, -, *, **, /, %
Logical: and, or, not
What is selection?
Selection occurs when a computer has to decide between multiple options based on the parameters provided
Why do we use selection?
We use selection because otherwise we would just get the same result from a programme every single time
Why do we use repetitions?
So that programmers do not have to repeatedly type out the same section of code multiple times
What is iteration and why do we use it?
Iteration is the process of repeating a block of code multiple times until the desired outcome is achieved - another name for this is a loop