Chapter 1: Slides introduction to Python
A __________ is a program that can analyze and execute a program line by line.
An interpreter is a program that can analyze and execute a program line by line.
Where in the computer is a variable such as "x" stored after the following Python line executes?
Main memory The main memory holds the values of the variables while a program executes
Central Processing Unit (CPU)
Runs the Program - The CPU is always wondering "what to do next". Not the brains exactly - very dumb but very fast
output devices
Screen, Speakers, Printer, DVD Burner
Secondary memory
Slower large permanent storage - lasts until deleted - disk drive / memory stick
What is the function of the secondary memory in a computer?
Store information for the long term, even beyond a power cycle
A brain is the human equivalent to what in your computer?
The Central Processing Unit is very similar to a brain for your computer.
Which of the following creates or contains "machine code"?
The Python interpreter
The Python interpreter or complier will tell you if your code has a __________ Error.
If your code doesn't follow the "grammar rules" of Python, it will let you know.
Pick the best replacements for 1 and 2 in the following sentence: When comparing compilers and interpreters, a compiler is like 1 while an interpreter is like 2.
1 = translating an entire book, 2 = translating a line at a time
What's the output of the following range expression?print(range(10, 101, 10))
10, 20, 30, 40, 50, 60, 70, 80, 90, 100
How many times will the following loop run? i = 3 while(i > 0) : i = i - 1
3
What will the following program print out:
44 While x was set to 43 originally it was changed to one more than the current value.
What is the output of below code? print(len("what's up"))
9
How many values can a Python function return ? Explain.
A function can return zero, one, two or more values.
A keyboard is an example of an Input or Output device?
A keyboard connects to your computer and provides information that your computer reads <b>in</b>.
When talking about computers and code, which of the following is a program?
A program holds the instructions that answer the CPU's "What next" question.
source code
A program in a high-level language before being compiled.
What is a program?
A sequence of instructions, which enables a computer to perform a desired task.
input devices
Keyboard, Mouse, Touch Screen, Voice
What is computational thinking?
Formulating problems Automating solutions Generalizing and transferring
semantic error
an error in the program that makes it do something other than what the programmer intended
Main Memory
fast small temporary storage - lost on reboot - aka RAM
compiler
needs to be handed the entire program in a file, and then it runs a process to translate the high-level source code into machine language and then the compiler puts the resulting machine language into a file for later execution.
interpeters
reads the source code of the program as written by the programmer, parses the source code, and interprets the instructions on the fly.
This keyword, ________, is used so that a function could send back a result that the function has performed (Quiz 3)
return
semantics
the meaning of a program
script
you enter a sequence of statements (lines) into a file using a text editor and tell Python to execute the statements in the file