Module 1 - Python Basics Flashcards
The purpose of this deck is to familiarize the student with the basics of Python syntax. (26 cards)
These are the set of rules that are used to create a Python program.
Python Syntax
It is a name used to identify a variable, function, class, module, or other object.
Identifier
True or False: Uppercase and lowercase letters are allowed in an identifier.
True
True or False: Numbers are allowed in an identifier.
True
True or False: Underscores are not allowed in an identifier.
False (Underscores are allowed in a Python identifier)
True or False: Symbols and special characters are allowed in an identifier.
False (Special characters are not allowed in an identifier.)
True or False: Python class names start with a capital letter.
True
Starting an identifier with a single leading underscore indicates that the identifier is a __________.
Private Identifier
A strongly private identifier starts with what?
Two leading underscores.
If the identifier ends with two trailing underscores, what is it called?
A language-defined special name.
These specific words are reserved and cannot be used in an identifier or variable name.
Python Keywords.
True or False: Python keywords start with an uppercase letter.
False (Python keywords start with a lowercase letter.)
What is used to denote a block of code?
Line Indentation
What symbol is used to denote a line continuation in Python?
\ (Backslash)
What statements do not need the use of the backslash?
[], {}, and ().
(Brackets, braces, and parentheses.)
These characters are used to define string literals.
’’, “”, “””
(single, double, and triple quotes)
True or False: Triple quotes are used to span the string across a single line.
False (triple quotes are used to span the string across multiple lines.)
This is a programmer-readable explanation or annotation in Python code.
Comment
What sign is used to denote a comment?
(hash sign)
These are variables whose values cannot be changed.
Constants
This is raw data given in a variable or constant.
Literals
Give the four kinds of literal collections.
- List
- Dictionary
- Tuple
- Set
What symbol denotes a list?
[ ] Brackets
What symbol denotes a set?
{ “ “ } braces