CHAPTER 3 Intro to Programming Flashcards
(93 cards)
In coding, IDLE, the color-coded text represents_____ and all the text that comes after “»” represents the______.
code output of the interactive shell
Courier New is a type of fix-width (non-proportional) font often used to display programming text why ?
because each character has the same width, so indentation and other display characteristics of code alignment are easier to observe.
Explain what a comment is?
A comment is a line (or part of a line) of code written in English (or another language) preceded by a special symbol that tells the programming language you are using to ignore that line (or part of a line) of code.
In Python, what symbol is used to create comment
pound symbol
What does a comment explain?
It explain what a line of code does
Programmers use comments to
clarify why they did something to make the line of code easier to understand for whoever
What can you write in a ‘COMMENT’?
You can write whatever you want in a comment
How long should the “comment” be
as long as it is only ONE LINE
When should you use comments
Use comments sparingly; do not comment on every line
Explain the use of a comment like this:
d = math.sqrt(l2 + w2) # length of the diagonal
Even if you understood exactly how this code works , you
still might not know how to calculate the length of a diagonal of a rectangle, which is why this
comment is useful.
Python programs are divided into
lines of code.
Print is indented by how many spaces?
4 spaces
Without proper _____, your program will not work.
spacing
Different kinds of data in Python are grouped into different
categories, or data types .
In python, each data value, like 2 or “Hello, World!” , is called an _____
object
For now, think of An object as a
data value in Python with three properties: an identity, a data type and a value (IDV)
The value of an object is the ______ it represents—
Data it represents; the number 2, for example, has a value of 2.
The identity of an object is where it is
stored in memory, which never changes (and which we will be ignoring for now).
The data type of an object is the ________of data the object belongs to
is the category of data the object belongs to, and determines the properties the object has.
What the determines the properties the object has?
The data type
When we refer to an object with a str data type, we call it a string; what is a string?
A string is a sequence of one or more characters surrounded by quotes.
You can use single quotes or double quotes, but the quotes at the beginning and end of a given string musT
match
“Hello World” is an example of what kind of data?
string
Strings are used to represent _______, and they have unique ______
text; properties