Unit 6 - Problem Solving with Programming Flashcards

1
Q

Why are input and output commands used?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you know whether input and output commands are correct?

A

They are highlighted in purple

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

Define a variable

A

A variable is a container within which you can store data which can then be referenced later on

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

List the 4 rules of when creating a variable

A
  1. It is not one of the reserved words
  2. Variable names are case sensitive
  3. A variable name has to begin with an underscore or a letter
  4. Variable names can include numbers or letters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List the 5 main data types

A
  • String
  • Float
  • Boolean
  • Integer
  • Character
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List the 5 main conversion commands

A
  • str()
  • bool()
  • int()
  • char()
  • float()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a string function?

A

These are built in commands which can be applied to variables in python

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

Give an example of a string function

A
  1. len()
  2. isalpha()
  3. isupper()
  4. islower()
  5. isdigit()
  6. capitalize()
  7. round()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are operators?

A

Operators are built in functions that allow you to perform specific functions

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

What are the three types of operator and give examples

A

Relational: >, =, !=, ==
Arithmetic: +, -, *, **, /, %
Logical: and, or, not

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

What is selection?

A

Selection occurs when a computer has to decide between multiple options based on the parameters provided

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

Why do we use selection?

A

We use selection because otherwise we would just get the same result from a programme every single time

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

Why do we use repetitions?

A

So that programmers do not have to repeatedly type out the same section of code multiple times

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

What is iteration and why do we use it?

A

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

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