Python 1 Flashcards

1
Q

Can you name two of the most basic functions in Python?

A

print ( ) Input ( )

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

What does the Print function do in Python?

A

It allows the computer program to communicate with the user by displaying information on screen.

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

When assigning names to variables, should they be written in uppercase, lowercase or a mixture of both?

A

Variables should be written in lowercase

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

How should different words be connected when writing names for variables?

A

With underscores

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

What character precedes a comment?

A

#

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

How would you include quotation marks when using the print command? For example how would you print to screen the below text?

he said it is a “beautiful day” in his country

A

A back slash is used before the special characters,

print (“he said it is a "beautiful day" in his country”)

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

How is a variable assigned in Python? (String)

In your example assign the word ‘Guitar’ to a variable called ‘Instrument’

A

instrument = “Guitar”

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

What two commands would set Peter to the variable name and then print it to screen.

A

name = “Peter”

print (name)

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

Name two of the most common errors that Python will return

A

SyntaxError

NameError

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

What is a floating number (or a float)?

A

A floating number is a decimal number.

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

How is a variable assigned in Python (Integer or float)

In your example assign an integer and a float number to a variable called ‘value_int and value _float’

A

value_int = 9

value_float = 9.1

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