Code Flashcards

1
Q

What is a syntax error?

A

A grammatical fault in the code such as improper use of indentation neglecting to include required symbols (e.g. a colon).

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

What is indentation commonly used for?

A

Indentation improve the readability of code, allowing the programmer to differentiate between various blocks (e.g. functions, loops and classes).

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

What is a function?

A

A block of code that can accept additional information in the form of additional arguments ( passed within brackets)

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

What is a variable?

A

A piece of data that can be assigned a value and can be altered in code.

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

What is the assignment operator?

A

=

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

What does an assignment operator do?

A

It assigns a value to a variable such as a number or a string.

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

What symbol is used to check if 2 variables are equal or if a variable is equal to a value?

A

==

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

What symbol is used to check if a variable is equal to or greater than a variable or a value?

A

> =

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

What symbol is used to check if a variable is equal to or less than a variable or a value?

A

<=

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

What is used in an if statement to make it only activate if multiple conditions are all met?

A

AND

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

What is used in an if statement to make it activate if any listed condition is met?

A

OR

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

What is triggered if an if statement is not met?

A

else

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

What must go after each conditional statement?

if, else, while etc

A

:

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

What is a string?

A

A set of alphanumeric characters that have no mathematical value therefore cannot be used in equations.

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

What is an integer?

A

A whole number

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

What is a float?

A

A decimal or negative number

-Also called a double

17
Q

Why may a string be used?

A

To check if the user’s input matches a certain phrase.

18
Q

What is used to gain user input?

A

input(“Enter displayed message here”)