Python –Real Study Guide – WGU – 2026/2027 |
Fully solved Exam
How are most Python programs developed?
Writing code in files - The Python interpreter can load and execute Python code
saved in files
string literal
text enclosed in quotes, may have letters, numbers, spaces , or symbols.
Given the variable num_cars = 9, which statement prints 9?
print(num_cars)
newline character
"\n" moves output to the next line
Whitspace
Any space, tab or newline
Input function
Causes the interpreter to wait until the user has entered some text and has
pushed the return key
string
It simply represents a sequence of characters.
Which statement reads a user-entered string into variable num_cars?
num_cars = input ()
Type
,Determines how a value can behave. For example, integers can be divided by 2,
but not strings ex 'Hello'
int function
can be used to convert that string to the integer for numbers
Type a statement that converts the string '15' to an integer and assigns
my_var with the result.
my_var = int('15")
syntax error
An error that results when an instruction does not follow the syntax rules or
grammar of the programming language.
Runtime error
An error that occurs when the program is run using certain sets of data that
result in some illegal operation, such as dividing by zero.
Crash
runtime error halts the execution of the program. Abrupt and unintended
termination of a program
logic error
errors may be subtle enough to silently misbehave, instead of causing a runtime
error and a crash. An example might be if a programmer accidentally typed "2 4"
rather than "2 40" - the program would load correctly, but would not behave as
intended
Bug
Is also called logic error
Integrated Development Environment (IDE)
Provides a developer with a way to create a program, run the program, and
debug the program all within one application.
, Application
another word for a program or software
Compiler
Translates a high-level language program into low-level machine instructions.
Ensures a program is valid according to the language's rules, performs
optimizations, then converts to the low-level machine instruction
Machine instructions
A series of 0s and 1s, stored in memory, tells a processor to carry out a
particular operation, such as multiplication. 0s and 1s are hard to comprehend.
Most programmers specify the program's functionality in a high-level language,
which is then automatically translated to low-level.
Assembly Language
Human-readable processor instructions. Is a program that translates instructions
into machine instructions.
Incremening
Increasing a variable's value by 1, as in x = x + 1
Open-source
Software that is created for free use by everyone
Object
represents a value and is automatically created by the interpreter when
executing a line of code. For example, executing x = 4 creates a new object to
represent the value 4
Garbage collection
removal of values that are no longer referenced by variables
Name binding