Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What does “.lower ()” do in Python?

A

.lower() - Prints the quote in all lower case letters.

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

What does “.upper ()” do in Python?

A

.upper() - Prints the quote in all upper case letters.

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

What does “.title ()” do in Python?

A

.title() - Prints the first letter of each word as a capital letter. 

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

What does “.capitalize ()” do in Python?

A

.capitalize() - It prints the quote; the first letter of the sentence with a capital letter.

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

What does “.strip ()” do in Python?

A

.strip() - It prints the quote; the first letter of the sentence with a capital letter.

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

What does “.replace (“excellent”, “outstanding”)” in Python?

A

.replace(“excellent”, “outstanding”) - It prints the quote but replaces “excellent” with “outstanding”.

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

What does “.centre (500)” do in Python?

A

.centre(500) - It prints the quote in the centre.

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

Strings as arrays (lists):

A

Each character in a string has an index (position).

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

Slicing strings:

A

You can also create substrings (part of a full string) or split your strings where needed. This is called slicing.

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

Converting characters:

A

All characters can be represented by a decimal(whole) number using ASCII or UNICODE. 
We can use string manipulation to convert characters to code and code back to a character.

e.g.
Convert number to character.
print (chr (97))

e.g.
Convert character to number. 
print (ord( “b”))

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

Comparison operator:

A == B

A

Equivalence (e.g. If x=5 or if x==5)

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

Comparison operator:

A != B

A

Does not equal (e.g. if x!=5)

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

Comparison operator:

A < B

A

Less than (e.g. if x<5)

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

Comparison operator:

A <= B

A

Less than or equal to (e.g. if x<=5)

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

Comparison operator:

A > B

A

Greater than (e.g. if x>5)

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

Comparison operator:

A >= B

A

Greater than or equal to (e.g. if x>=5)

17
Q

KEY WORDS:

A
18
Q

Variable:

A

A named piece of memory that holds a value.

19
Q

User defined:

A
20
Q

Program defined:

A
21
Q

Type casting:

A

Changing the data type of a variable.

22
Q

Comparison operators:

A

An operator that performs Boolean logic on input data to result a result that is true or false. They allow for assignment and for comparisons to be made.