Module 1 - Python Basics Flashcards

The purpose of this deck is to familiarize the student with the basics of Python syntax.

1
Q

These are the set of rules that are used to create a Python program.

A

Python Syntax

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

It is a name used to identify a variable, function, class, module, or other object.

A

Identifier

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

True or False: Uppercase and lowercase letters are allowed in an identifier.

A

True

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

True or False: Numbers are allowed in an identifier.

A

True

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

True or False: Underscores are not allowed in an identifier.

A

False (Underscores are allowed in a Python identifier)

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

True or False: Symbols and special characters are allowed in an identifier.

A

False (Special characters are not allowed in an identifier.)

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

True or False: Python class names start with a capital letter.

A

True

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

Starting an identifier with a single leading underscore indicates that the identifier is a __________.

A

Private Identifier

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

A strongly private identifier starts with what?

A

Two leading underscores.

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

If the identifier ends with two trailing underscores, what is it called?

A

A language-defined special name.

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

These specific words are reserved and cannot be used in an identifier or variable name.

A

Python Keywords.

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

True or False: Python keywords start with an uppercase letter.

A

False (Python keywords start with a lowercase letter.)

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

What is used to denote a block of code?

A

Line Indentation

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

What symbol is used to denote a line continuation in Python?

A

\ (Backslash)

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

What statements do not need the use of the backslash?

A

[], {}, and ().

(Brackets, braces, and parentheses.)

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

These characters are used to define string literals.

A

’’, “”, “””

(single, double, and triple quotes)

17
Q

True or False: Triple quotes are used to span the string across a single line.

A

False (triple quotes are used to span the string across multiple lines.)

18
Q

This is a programmer-readable explanation or annotation in Python code.

A

Comment

19
Q

What sign is used to denote a comment?

A

(hash sign)

20
Q

These are variables whose values cannot be changed.

A

Constants

21
Q

This is raw data given in a variable or constant.

A

Literals

22
Q

Give the four kinds of literal collections.

A
  1. List
  2. Dictionary
  3. Tuple
  4. Set
23
Q

What symbol denotes a list?

A

[ ] Brackets

24
Q

What symbol denotes a set?

A

{ “ “ } braces

25
Q

What symbol denotes a tuple?

A

( ) parentheses

26
Q

What symbols denote a dictionary?

A

{ “ “ : “ “ } Parentheses and colons.