Basics/principles Flashcards

1
Q

Variable

A

A container for a value, it behaves as the value it contains.

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

Float

A

A number with a decimal portion

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

Integer (Int)

A

A whole number

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

Type

A

Can be used to identify the value type of a variable

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

String or “str”

A

A series of letters

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

Boolean

A

A value that is either “true” or “false”

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

Multiple assignment

A

Allows you to give values to multiple variables in one line of code

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

What is this line of code an example of?
Name, age, cool = “alex”, 15, True

A

This is an example of multiple assignment

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

What is this an example of?
Alex = Dino = James = Rhea = “cool”

A

This is an example of multiple assignment.

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

Type casting

A

Converting the data type of a value to another data type e.g from integer to string

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

Input()

A

This allows for the user to give input

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

What is this doing?
Name = input(“What is your name?”)

A

This is assigning the users input to the variable “Name”

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

An absolute value

A

How far away a number is from 0

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

Slicing

A

Creating a substring by extracting elements from another string

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

Indexing[]

A

A form of slicing that uses square brackets

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

Slice()

A

A form of slicing that uses brackets

17
Q

[start:stop:step]

A

3 optional arguments needed when slicing

18
Q

Slicing a string with the square brackets

A

Alex =“alex”
Print(alex[0:4:1])

Console:
Alex

19
Q

The start index

A

Defines where the variable will start.
(Inclusive)

20
Q

The stop index

A

Defines where the variable will end.
(Exclusive)

21
Q

The step index

A

Defines by how many places the variable is used
E.g

Name = “Alexander”

Print(Name[0:9:2]

Console:
lxne

22
Q

Difference between slice() and indexing[]

A

In slicing as an oppose to using colons to separate your indexes [start:stop:step]

You would use commas
(Start,stop,step)

And instead of using square brackets you would use normal brackets)

23
Q

If statement

A

A block of code that will only execute if it’s condition is true

24
Q

Hierarchy in (if , elif, else)

A

/\
| If
|
| Elif
|
| Else
\/

25
Q

Logical operators (and,or)

A

Used to check if two or more conditions are true

26
Q

The not operator

A

Changes a true value to false and a false value to true

27
Q

Assignment operator

A

=

28
Q

Equivalent operator

A

==

29
Q

The process of linking two different data with types

A

Concatenation

30
Q

IDE

A

Integrated development environment

31
Q

the difference between return and print()

A

A Python function without a return statement returns None

32
Q

What is “I” in a for loop

A

i or whatever character you choose to assign is a way to extract a value in a variable (“in variable” is referring to any variable)
“for x in variable:
print(x)”

This will print the value of x in the variable.

33
Q

Nested loops

A

A loop within a loop
The “inner loop” will finish all of it’s iterations before finishing one iteration of the”outer loop”

34
Q

Loop control statements

A

Changes a loops execution from its normal sequence.

35
Q

Break

A

Used to terminate the loop entirely

36
Q

Continue

A

Skips to the next iteration of the loop

37
Q

A module

A

A file containing a set of functions you want to use in your application. e.g “math”

38
Q

Pass

A

does nothing, acts as a placeholder

39
Q

Index operator[]

A

Gives access to a sequences elements

(Used in strings,lists,tuples but not limited to these three)