Week 2 Ch2 Flashcards
What is an integer value?
A number value
What is a floating point?
Decimal integer
What is a string value?
String of characters
In python strings belong to what type?
Str
In Python integers belong to what type?
Int
In python flouncing points belong to what type?
Float
If numbers are in quotation marks. are they still strings?
Yes they are considered strings in Python
What do commas do in Python?
Think it is a list of separated values
What is a variable?
Name that refers to a value
What is a common way to represent variables on paper?
Write the name with arrow pointing to variables value.
Type of a variable is the type of ______it refers to
Value
What do variable names have to begin with?
A letter
If you give a variable an illegal name what happens ?
Syntax error
Can variable names contain illegal characters?
No they cannot
Can variable names contain Python keywords?
No they cannot
What is a value?
Something a program manipulates
What is an expression?
It is a combination of values, variables, and operators
What is a statement?
Unit of code that Python interpreter can execute
What is the difference between an expression and statement?
Expression has a value
Order of evaluation depends on what?
Rules of precedence
What has the highest precedence?
Parentheses
What is after parentheses in the order of precedence?
It is exponents
What precedence do multiplication and division have?
They have the same precedence
Operators with the same precedence are evaluated in what order?
Left to right
Can you perform mathematical operations on strings?
No
What does the plus operator + do?
It concatenates. Joins strings together.
What are two statements?
Assignment and print
Does the assignment statement produce an output
No it does not
When the interpreter displays the value of an expression, what format does it use?
Uses same format you would use to enter a value.
What will the print statement do with strings in quotation marks?
Display string without quotations.
What are operators?
Special symbols that represent computations like addition
What is this **?
Means exponentation
What does the * operator do on strings?
It performs repetition. One of the operands has to be a string and the other has to be an integer.
What is one of the most useful things about programming languages?
Ability to take small building blocks and compose them.
Where can you put line # comments ?
At the start and end of a line
Should comments be used to explain why you did something a certain way?
Yes they should