Week 2: Programming Basics Flashcards
What is a string (text)?
strings are used for representing textual data. A string is a sequence of characters enclosed in either single quotes (‘’) or double quotes (“”)
What are variables?
Values. Placeholder for information.
What will come out of Python:
print(“hello world”)
Hello World
What calculation will come out of Python: original_num = 23
new_number = original_num + 1
24
How to use Concatenate?
Add ‘whole_’ in front of the string
punc is what?
Punctuation marks like commas or exclamation points
How to use punctuation in Python?
punc = “!”
What is the rule about having #s in variables?
Cannot begin with the #
How could you get Python to show:
4
print(2+2)
What are they called, the words that cannot be assigned to variables?
keywords or reserved words
What is a % and what is its function?
modulo operator and its function is division–but only the remainder.
What would become of this: num + 10 % 3
a value of 1
How do you increase an operator and what is its shorthand?
age = age + 1
age += 1
When there are multiple math symbols, how do you tell Python to focus on a section first?
parentheses. Example: num = 2 + 2 (3 * 4)
or
num = ((2 * 4) * 4) + 2