Python Coding Flashcards

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

How would you explain Python coding?

A

It is a high-level programming language

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

What is missing from this line of code?

print(“hello what is your first name?)

A

Missing a “ at the end

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

What does the code below do?

username = input (“please enter your username”)

A

Asks a user for their username and then stores it in the variable called username

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

What does this line of Python code do?

//welcome to my quiz

A

Nothing - it is a comment

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

Describe is a syntax error?

A

When the code has a spelling mistake or missing punctuation in the code

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

Float is a data type. What is it used for?

A

Decimal numbers

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

Integer is a data type. What is it used for?

A

Whole numbers

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

String is a data type. What is it used for?

A

Text

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

What is the best data type for a phone number?

A

String

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

What is the best data type for a shoe size?

A

Float

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

When this code has run, what value does the variable total contain?

number_one = 12

number_two = 4

total = number_one + number_two

A

16

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

number_one = “12”

number_two = “4”

total = number_one + number_two

A

124 - they are both strings as they are in “ “ so joined together as a string rather than added

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

What is missing from the code below
if score == 10
print (“well done”)

A

Missing : at the end of the if statement

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

Why do we use comments in coding?

A

To explain what the code does

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

What is this called when we join two or more words together?
print (“score” + score + “out of 100”)

A

Concatenation

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

What is this called when we change a string to an integer?
answer = int(answer)

A

Casting

17
Q

An if statement is an example of?

A

Selection

18
Q

Print is an example of?

A

Sequence

19
Q

When do I use =?

A

To create a variable

20
Q

When do I create ==?

A

To check if two values are equal