Python Programming Tutorial
- 95Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
95 questions
- 1Python is described as a_____programming language because it can be used across many application domains.
Hint
Think of a language that is not limited to one specialty.
Answer
general purpose
Explanation
A general purpose language can be used to write software in various application domains rather than being restricted to a particular domain.
- 2Python is a_____language, meaning its syntax uses natural-language elements that make code easier to read and understand.
Hint
This describes how closely a language’s syntax relates to human-readable language.
Answer
high level
Explanation
A high level language uses natural-language elements and automates significant parts of computing, such as memory allocation and management.
- 3Python is called an_____language because scripts are saved and executed in the format in which they were created.
Hint
Contrast this with languages whose code is translated into machine-specific instructions before execution.
Answer
interpreted
Explanation
An interpreted language executes the script in its original format, rather than first producing a machine-specific executable file.
- 4Python is_____typed because its parser infers a variable’s type from the data assigned to it.
Hint
The type is identified automatically rather than declared in advance.
Answer
dynamically
Explanation
In a dynamically typed language, Python identifies a variable’s type based on the value assigned to it.
- 5The creator of Python named in the content is_____.
Hint
Recall the person credited with creating the language.
Answer
Guido van Rossum
Explanation
The content identifies Guido van Rossum as the creator of Python.
- 6Unlike a domain-specific language, a general purpose language is not restricted to_____application domain.
Hint
Think about whether the language is confined to one specialty.
Answer
a particular
Explanation
General purpose languages can be used in various application domains without being restricted to a particular domain.
- 7A high level language can automate memory allocation and_____while coding.
Hint
This word completes the phrase describing what happens to memory.
Answer
management
Explanation
The content says high level languages automate significant computing tasks, including memory allocation and management.
- 8In Python, assigning a new kind of value to a variable does not require the programmer to declare its_____first.
Hint
This is the category that Python infers from the assigned value.
Answer
data type
Explanation
Python’s dynamic typing means the parser infers the variable’s type from its assigned data, so the programmer does not need to declare it first.
- 9The content contrasts interpreted languages with languages whose code is translated into machine-specific_____before being saved as an executable.
Hint
These are the operations a computer processor can execute.
Answer
instructions
Explanation
In the contrast described, code is translated into machine-specific instructions and then saved as an executable file.
- 10A variable assigned a string and then an integer illustrates Python’s ability to infer a variable’s type from its current_____.
Hint
Consider what the parser examines to determine the type.
Answer
assigned data
Explanation
Python automatically infers the type of a variable based on the data assigned to it.
- 11Python is widely used in areas such as web development, machine learning, data science, and_____.
Hint
This application area often involves carrying out repetitive tasks automatically.
Answer
automation
Explanation
The content lists automation among Python’s varied application domains.
- 12The content describes Python’s English-like and elegant_____as a reason it stands out from other languages.
Hint
This refers to the rules and structure used to write code.
Answer
syntax
Explanation
Python’s English-like, elegant syntax is presented as a feature that makes it especially understandable.
- 13One reason beginners may find Python approachable is that it is designed to be easy to read and_____.
Hint
What do programmers do when creating source code?
Answer
write
Explanation
The content emphasizes that Python is designed to be easy to read and write, including for beginners.
- 14Python is free and open source, so the public can download, use, modify, and_____its source code.
Hint
This is what users can do when sharing a modified or original copy.
Answer
distribute
Explanation
The content says the public can download, use, modify, and distribute Python’s source code.
- 15Python’s open-source nature allows its source code to be available to the_____.
Hint
This refers to everyone outside a private organization.
Answer
public
Explanation
Open source means the source code is available for the public to access and use.
- 16Writing fewer lines of code can reduce the_____needed to write a program.
Hint
Less code can mean less of this resource is spent during development.
Answer
time
Explanation
The content connects Python’s shorter code with reduced time needed to write programs.
- 17The example in the content says a Hello World program can take one line in Python, compared with at least_____lines in other languages.
Hint
Recall the approximate range given for the comparison.
Answer
two to three
Explanation
The content contrasts Python’s one-line Hello World example with at least two to three lines in other languages.
- 18Python’s large_____can help programmers find assistance when they get stuck.
Hint
This is the group of people who use and support the language.
Answer
community
Explanation
A large community gives Python users people they can reach out to for help.
- 19Python is increasingly preferred for data science partly because of its_____nature.
Hint
This means it can be applied in many different ways.
Answer
versatile
Explanation
The content describes Python as versatile and connects that quality to its popularity in data science.
- 20Python supports the object-oriented programming_____.
Hint
This is the model or approach to organizing programs around objects.
Answer
paradigm
Explanation
Python follows the object-oriented programming paradigm, allowing programs to be organized into individual objects.
- 21Grouping and bundling a program into individual objects can make its code look neat and easy to_____.
Hint
The benefit concerns how clearly people can interpret the code.
Answer
understand
Explanation
The content says object-oriented organization can make code neat and easy to understand.
- 22A Python program written on Windows can also run on Linux with little or no_____.
Hint
This refers to changes needed when moving a program between systems.
Answer
modifications
Explanation
Python is cross platform, so a program written on Windows can run on Linux with little or no modifications.
- 23Python can be integrated with languages such as C, C++, and_____.
Hint
This is another programming language named in the content.
Answer
Java
Explanation
The content notes that Python can be integrated with C, C++, Java, and other languages.
- 24Python’s libraries are described as large, rich, and_____platform compatible.
Hint
The word refers to compatibility across different operating systems.
Answer
cross
Explanation
The content emphasizes that Python has a large collection of libraries that are cross platform compatible.
- 25Python can create web applications with different levels of_____.
Hint
This describes how simple or intricate an application may be.
Answer
complexity
Explanation
The content says Python is used to create web applications of different levels of complexity.
- 26Python supports data analysis in part through libraries such as NumPy and_____.
Hint
This library is named alongside NumPy in the content.
Answer
pandas
Explanation
The content identifies NumPy and pandas as examples of libraries used for data analysis.
- 27Python can implement predictive analysis for machine learning using libraries such as scikit-learn and_____.
Hint
This machine-learning library is named alongside scikit-learn.
Answer
TensorFlow
Explanation
The content lists scikit-learn and TensorFlow among Python’s machine-learning libraries for predictive analysis.
- 28The Python module named in the content for game development is_____.
Hint
It is a game-development module whose name combines Python with “game.”
Answer
Pygame
Explanation
The content identifies Pygame as a module used for game development.
- 29Automating repetitive work in Python can include sending emails, opening a browser, and posting a_____status.
Hint
The example refers to a social media platform.
Answer
Facebook
Explanation
The content gives posting a Facebook status as an example of repetitive work Python can automate.
- 30The content connects Python’s many applications across domains with a wide range of career_____.
Hint
These are possibilities for employment and professional growth.
Answer
opportunities
Explanation
Because Python has applications in many domains, the content says it can open up many career opportunities.
- 31For a beginner choosing between Python 2 and Python 3, the recommendation in the content is to learn Python_____.
Hint
The content says the other major version is becoming obsolete.
Answer
3
Explanation
The content recommends Python 3 because more companies were moving away from Python 2 and community support for Python 3 was stronger.
- 32In the version discussion, Python 2.7 is described as becoming_____.
Hint
This means it is increasingly outdated and no longer the recommended choice.
Answer
obsolete
Explanation
The content advises beginners not to spend time learning a version that is becoming obsolete, referring to Python 2.7.
- 33The content says more companies were moving from Python 2 to Python_____.
Hint
This is the newer major version recommended for beginners in the lesson.
Answer
3
Explanation
The content describes companies moving from Python 2 to Python 3.
- 34The Instagram example says that in 2017 it migrated most of its Python code base from Python 2.7 to Python_____.
Hint
This is the newer major version in the migration example.
Answer
3
Explanation
The content states that Instagram migrated the majority of its Python code base from Python 2.7 to Python 3 in 2017.
- 35The content says the Python 3 community support is_____than the support for Python 2.
Hint
This is a comparative description of the level of community support.
Answer
better
Explanation
The lesson gives better community support for Python 3 as a reason to choose it.
- 36The default way to interact with Python mentioned in the content is the Python_____.
Hint
This abbreviation means command-line interface.
Answer
CLI
Explanation
The content says that by default, users can use the Python CLI to write and execute code.
- 37Anaconda is recommended because its distribution includes Python, Jupyter Notebook, and commonly used_____.
Hint
These are reusable software components often installed with a programming environment.
Answer
packages
Explanation
The content recommends Anaconda because it includes Python, Jupyter Notebook, and other commonly used packages.
- 38Jupyter Notebook is a_____based application for writing Python code.
Hint
It opens in a browser rather than being described as a desktop-only interface.
Answer
web
Explanation
The content describes Jupyter Notebook as a web based application for writing Python code.
- 39Jupyter Notebook provides an interactive_____science environment.
Hint
This field involves analyzing and interpreting data.
Answer
data
Explanation
The content says Jupyter Notebook offers an interactive data science environment.
- 40The lesson says Python IDEs can help with coding and_____.
Hint
This is the process of finding and fixing problems in a program.
Answer
debugging
Explanation
The content notes that IDEs such as those available with Anaconda can help with coding and debugging.
- 41A Python token is the smallest meaningful component of the source_____.
Hint
Tokens are the basic components that make up a program’s written form.
Answer
code
Explanation
The content defines a Python token as a basic, smallest meaningful component of source code.
- 42The four token categories listed are keywords, literals, identifiers, and_____.
Hint
This category includes symbols or words that perform tasks such as addition or comparison.
Answer
operators
Explanation
The content groups Python tokens into keywords, literals, identifiers, and operators.
- 43A Python keyword is a reserved word designed for a specific_____.
Hint
A keyword has a defined role in the language.
Answer
purpose
Explanation
Keywords are reserved words with specific purposes and meanings in Python.
- 44The name given to a variable, function, or class is an_____.
Hint
This is the programming term for a name used to identify an element in code.
Answer
identifier
Explanation
An identifier is the name assigned to a variable, function, or class.
- 45Python identifiers may contain letters, digits, and the underscore, but no other_____characters.
Hint
The rule excludes punctuation symbols other than the permitted underscore.
Answer
special
Explanation
The content states that no character except the underscore can be used as a special character in an identifier.
- 46A Python identifier cannot begin with an_____.
Hint
The first character must instead be a letter or underscore.
Answer
integer
Explanation
The content says an identifier’s first character may be a character or underscore, but not an integer.
- 47Python is case sensitive, so identifiers_____
aandAare treated asnames.Hint
Changing capitalization affects whether Python sees the names as identical.
Answer
different
Explanation
In Python, lowercase and uppercase versions of a name are distinct identifiers.
- 48Because keywords are reserved, words such as_____
ifandwhilecannot be used as variable.Hint
This is what an identifier provides to a variable.
Answer
names
Explanation
Keywords have specific meanings in Python and cannot be used as identifier names, including variable names.
- 49In_____
a = 10, Python infers thatais anfrom the assigned value.Hint
The assigned value is a whole number with no decimal point.
Answer
integer
Explanation
Python infers the data type from the assigned value; the lesson identifies 10 as an integer.
- 50In_____
name = "Victor", Python infers thatnameis abecause it stores text.Hint
This data type represents text enclosed in quotation marks.
Answer
string
Explanation
The content explains that Python identifies a variable as a string when it stores a string value.
- 51A value such as 2000.23 is inferred as a_____data type.
Hint
This numerical type represents values with a decimal point.
Answer
float
Explanation
A number with a decimal point is identified as a floating-point value, or float.
- 52Python allows the same value to be assigned to several variables at once using chained_____.
Hint
This technique assigns values to variables in a single statement.
Answer
assignment
Explanation
The content shows
a = b = c = 10as a way to assign one value to several variables at once. - 53Different values can be assigned to multiple variables in one statement by matching comma-separated names with comma-separated_____.
Hint
Each name is paired with the corresponding item on the right side of the assignment.
Answer
values
Explanation
The content demonstrates assigning different values to several variables by listing names and values in corresponding comma-separated sequences.
- 54A string literal can be created by enclosing text in either single or double_____.
Hint
These punctuation marks surround the text value.
Answer
quotes
Explanation
Python string literals can be written using either single quotes or double quotes.
- 55In the content, a multiline string is demonstrated by enclosing text in triple_____.
Hint
The delimiter uses three repeated marks around the text.
Answer
quotes
Explanation
The lesson demonstrates multiline string input using triple quotes.
- 56The four numeric literal types listed are integer, long integer, floating number, and_____number.
Hint
This numerical category can include an imaginary component.
Answer
complex
Explanation
The content lists integer, long integer, floating number, and complex number as numeric literal types.
- 57A numerical literal containing no decimal point is treated as an_____.
Hint
This type represents whole-number values in the lesson’s explanation.
Answer
integer
Explanation
The content says that a numerical literal without a decimal point is an integer.
- 58A numerical literal containing a decimal point is treated as a_____.
Hint
This numerical type represents values with a fractional part.
Answer
float
Explanation
The content says that a numerical literal with a decimal point becomes a float.
- 59The content says a number can contain only one_____point.
Hint
This punctuation separates the whole-number and fractional parts of a decimal value.
Answer
decimal
Explanation
A numeric literal may contain a decimal point, but the content states that it can have only one.
- 60Python integers can grow according to the limit of the available_____.
Hint
This is the computer resource used to store values.
Answer
memory
Explanation
The content says integer values are not restricted by a fixed width and can expand to the limit of available memory.
- 61A Boolean literal in Python has one of two values:_____
Trueor.Hint
This is the opposite Boolean value to
True.Answer
False
Explanation
The content identifies
TrueandFalseas the two Boolean literal values. - 62Because_____
TrueandFalseare keywords, they cannot be used as identifier.Hint
This is what variable, function, and class identifiers are used for.
Answer
names
Explanation
The content notes that Boolean values are also keywords, so they cannot be used as identifiers.
- 63The special literal used to specify a value that is not created is_____.
Hint
It is Python’s special value for the absence of a value in the lesson.
Answer
None
Explanation
The content says Python has one special literal,
None, used to specify a value that is not created. - 64The content compares Python’s_____
Noneto thenullkeyword in C, C++, and.Hint
This is the third language named in the comparison.
Answer
Java
Explanation
The lesson presents
Noneas equivalent to thenullkeyword in C, C++, or Java. - 65Numbers, strings, and tuples are classified in the content as_____data types.
Hint
These values cannot be changed or modified in place, according to the lesson.
Answer
immutable
Explanation
The content groups numbers, strings, and tuples as immutable data types.
- 66Lists, dictionaries, and sets are classified as_____data types.
Hint
These data structures can be changed after they are created.
Answer
mutable
Explanation
The content identifies lists, dictionaries, and sets as mutable data types.
- 67The_____
typefunction can be used to find a variable’s data.Hint
The function’s name indicates the information it reports.
Answer
type
Explanation
The lesson demonstrates using
typeto check whether variables are integers, strings, or floats. - 68The_____
int,float, andcomplexfunctions are examples of functions that can explicitly convert a value’s.Hint
They can convert a value into a different category of data.
Answer
datatype
Explanation
The content says explicit conversion can be performed with functions such as
int,float, andcomplex. - 69Python has seven operator categories in the lesson: arithmetic, assignment, comparison, logical, bitwise, identity, and_____.
Hint
This category checks whether a value belongs to a sequence.
Answer
membership
Explanation
The content lists seven operator categories, with membership as the final category.
- 70The arithmetic operator in_____
2 + 3is thesign.Hint
This symbol performs addition.
Answer
plus
Explanation
The content identifies
+as an arithmetic operator and uses it to add two operands. - 71The arithmetic operator that finds the remainder after division is the_____operator.
Hint
It is often represented by the percent symbol in Python.
Answer
modulo
Explanation
The content lists modulo among the arithmetic operators, alongside addition, subtraction, multiplication, and division.
- 72The_____
=operator assigns ato a variable.Hint
In
var = 10, this is the item placed intovar.Answer
value
Explanation
An assignment operator is used to assign a value to a variable.
- 73The shorthand statement_____
var += 10adds 10 tovarand assigns the result back to.Hint
The same variable appears on the left side of the shorthand update.
Answer
var
Explanation
The content explains that
var += 10is equivalent tovar = var + 10. - 74Comparison operators such as less than and not equal to return_____
Trueor.Hint
These operators produce one of the two Boolean outcomes.
Answer
False
Explanation
Comparison operators compare two values and return either
TrueorFalse. - 75If_____
a = 10andb = 20, the comparisona > bevaluates to.Hint
Compare the size of 10 with the size of 20.
Answer
False
Explanation
Ten is not greater than twenty, so the comparison evaluates to
False. - 76The logical operators listed in the content are_____
and,or, and.Hint
This operator reverses a Boolean condition.
Answer
not
Explanation
The content identifies
and,or, andnotas Python’s logical operators. - 77The logical expression_____
False and Trueevaluates to.Hint
For
andto be true, both operands must be true.Answer
False
Explanation
A logical
andexpression is true only when both conditions are true; since one operand is false, the result is false. - 78Bitwise operators perform calculations on the binary_____of values.
Hint
These are the binary digits, 0 and 1.
Answer
bits
Explanation
The content describes bitwise operators as performing bitwise calculations on values.
- 79The bitwise_____
oroperation on 7 and 5 produces.Hint
In binary, 7 is 111 and 5 is 101; combine corresponding bits with OR.
Answer
7
Explanation
Since the binary forms are 111 and 101, applying bitwise OR gives 111, which is 7.
- 80The bitwise_____
andoperation on 7 and 5 produces.Hint
In binary, 111 AND 101 leaves only the positions where both bits are 1.
Answer
5
Explanation
The binary forms of 7 and 5 are 111 and 101; their bitwise AND is 101, which is 5.
- 81In the content’s example, the bitwise NOT operation on 7 produces_____.
Hint
The lesson shows that flipping the bits leads to this negative decimal result.
Answer
-8
Explanation
The content demonstrates that applying bitwise NOT to 7 gives -8.
- 82The example_____
10 >> 2shifts the binary bits two places to the right and gives.Hint
The binary form of 10 is 1010; move its bits two places right.
Answer
2
Explanation
Right-shifting the binary value 1010 by two places gives 0010, which is 2 in decimal.
- 83The example_____
10 << 2shifts the binary bits two places to the left and gives.Hint
Appending two zero bits to binary 1010 produces the resulting value.
Answer
40
Explanation
Left-shifting 10, whose binary form is 1010, by two places gives 101000, which equals 40.
- 84The identity operators_____
isandis nottest whether two operands share an.Hint
They test whether operands are the same object, rather than compare their values.
Answer
identity
Explanation
The content says identity operators test whether two operands share an identity.
- 85The membership operators_____
inandnot intest whether a value belongs to a.Hint
Examples named in the lesson include a list, string, or tuple.
Answer
sequence
Explanation
Membership operators check whether a value is a member of a sequence such as a list, string, or tuple.
- 86For the list_____
dog,cat, andwolf, checking whetherlionisinthe list returns.Hint
Check whether the named animal appears among the three listed entries.
Answer
False
Explanation
Since
liondoes not appear in the list, the membership test returnsFalse. - 87In a Python string, the first character is accessed using index_____.
Hint
Python string indexing begins at the starting position.
Answer
0
Explanation
The content demonstrates that the first character of a string is at index 0.
- 88In Python, the last character of a string can be accessed using index_____.
Hint
A negative index counts backward from the end of the string.
Answer
-1
Explanation
The content uses index -1 to access the last character of a string.
- 89When extracting a substring with a slice, the ending index is_____in the result.
Hint
The slice includes positions up to, but not including, its endpoint.
Answer
not included
Explanation
The content explains that a slice from index 0 to index 5 includes characters before index 5, but not the character at index 5.
- 90The string method that returns the position where a requested substring begins is `_____.`
Hint
Its name describes searching for a piece of text.
Answer
find
Explanation
The
findfunction returns the position of the requested substring within a string. - 91In the word_____
attachment, the substringmebegins at index.Hint
Count from zero: the letters before
mare a, t, t, a, c, h.Answer
6
Explanation
With zero-based indexing, the
minattachmentis at position 6, where the substringmebegins. - 92The string method used to replace one character or substring with another is `_____.`
Hint
Its name describes substituting one piece of text for another.
Answer
replace
Explanation
The
replacefunction replaces one character or string with another. - 93To change a string by replacing_____
mewithm, the lesson uses the string’s `.` method.Hint
This method takes the old text and the replacement text as arguments.
Answer
replace
Explanation
The content demonstrates using the
replacemethod to substitutemfor the substringme. - 94A string containing multiple lines can be represented in the demonstrated way using_____quotation marks at the beginning and end.
Hint
The delimiter uses a repeated quotation mark three times.
Answer
three
Explanation
The content shows multiline strings enclosed with three quotation marks at each end.
- 95In the string_____
hello world, the slice from index 0 up to index 5 extracts.Hint
The endpoint is excluded, so the slice includes the first five characters.
Answer
hello
Explanation
A slice from 0 to 5 includes indices 0 through 4, which spell
hello.

Ask anything
We've read this whole study set, so questions about it get the best answers.